From ca54953579c22fe635627ce6024cd026d9fcc9b2 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Wed, 5 Feb 2014 17:24:26 +0000 Subject: - log --- src/mesh/gnunet-service-mesh_hello.c | 10 ++++++++-- src/mesh/gnunet-service-mesh_peer.c | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/mesh/gnunet-service-mesh_hello.c b/src/mesh/gnunet-service-mesh_hello.c index bde6592d6..e98300b0b 100644 --- a/src/mesh/gnunet-service-mesh_hello.c +++ b/src/mesh/gnunet-service-mesh_hello.c @@ -105,7 +105,9 @@ got_hello (void *cls, const struct GNUNET_PeerIdentity *id, LOG (GNUNET_ERROR_TYPE_ERROR, " hello with NULL id\n"); return; } - LOG (GNUNET_ERROR_TYPE_DEBUG, " hello for %s\n", GNUNET_i2s (id)); + LOG (GNUNET_ERROR_TYPE_INFO, " hello for %s (%d bytes), expires on %s\n", + GNUNET_i2s (id), NULL != hello ? GNUNET_HELLO_size (hello) : -1, + GNUNET_STRINGS_absolute_time_to_string(GNUNET_HELLO_get_last_expiration(hello))); if (NULL == hello) { LOG (GNUNET_ERROR_TYPE_DEBUG, " hello is NULL\n"); @@ -115,7 +117,10 @@ got_hello (void *cls, const struct GNUNET_PeerIdentity *id, GMP_set_hello (peer, hello); if (GMP_get_short_id (peer) == myid) - mine = hello; + { + mine = GMP_get_hello (peer); + LOG (GNUNET_ERROR_TYPE_DEBUG, " updated mine to %p\n", mine); + } } @@ -165,6 +170,7 @@ GMH_shutdown () const struct GNUNET_HELLO_Message * GMH_get_mine (void) { + LOG (GNUNET_ERROR_TYPE_DEBUG, " mine is %p\n", mine); return mine; } diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c index 3cf84ab75..e8b332c7d 100644 --- a/src/mesh/gnunet-service-mesh_peer.c +++ b/src/mesh/gnunet-service-mesh_peer.c @@ -1888,20 +1888,23 @@ GMP_set_hello (struct MeshPeer *peer, const struct GNUNET_HELLO_Message *hello) struct GNUNET_HELLO_Message *old; size_t size; + LOG (GNUNET_ERROR_TYPE_DEBUG, "New hello for %s\n", GMP_2s (peer)); if (NULL == hello) return; old = GMP_get_hello (peer); + LOG (GNUNET_ERROR_TYPE_DEBUG, " old hello %p\n", old); if (NULL == old) { size = GNUNET_HELLO_size (hello); + LOG (GNUNET_ERROR_TYPE_DEBUG, " new size: %u\n", size); peer->hello = GNUNET_malloc (size); memcpy (peer->hello, hello, size); - return; } else { peer->hello = GNUNET_HELLO_merge (old, hello); + LOG (GNUNET_ERROR_TYPE_DEBUG, " merge! %p\n", peer->hello); GNUNET_free (old); } } @@ -1920,6 +1923,7 @@ GMP_get_hello (struct MeshPeer *peer) struct GNUNET_TIME_Absolute expiration; struct GNUNET_TIME_Relative remaining; + LOG (GNUNET_ERROR_TYPE_DEBUG, "Get hello\n"); if (NULL == peer->hello) return NULL; @@ -1927,6 +1931,8 @@ GMP_get_hello (struct MeshPeer *peer) remaining = GNUNET_TIME_absolute_get_remaining (expiration); if (0 == remaining.rel_value_us) { + LOG (GNUNET_ERROR_TYPE_DEBUG, " expired on %s\n", + GNUNET_STRINGS_absolute_time_to_string (expiration)); GNUNET_free (peer->hello); peer->hello = NULL; } -- cgit v1.2.3