diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-02-05 17:24:26 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-02-05 17:24:26 +0000 |
commit | ca54953579c22fe635627ce6024cd026d9fcc9b2 (patch) | |
tree | 690a553509485e4b33f87402686b625eab814e3e | |
parent | 08c8619f606619598faac80fb240079ec6ee54fd (diff) | |
download | gnunet-ca54953579c22fe635627ce6024cd026d9fcc9b2.tar.gz gnunet-ca54953579c22fe635627ce6024cd026d9fcc9b2.zip |
- log
-rw-r--r-- | src/mesh/gnunet-service-mesh_hello.c | 10 | ||||
-rw-r--r-- | 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, | |||
105 | LOG (GNUNET_ERROR_TYPE_ERROR, " hello with NULL id\n"); | 105 | LOG (GNUNET_ERROR_TYPE_ERROR, " hello with NULL id\n"); |
106 | return; | 106 | return; |
107 | } | 107 | } |
108 | LOG (GNUNET_ERROR_TYPE_DEBUG, " hello for %s\n", GNUNET_i2s (id)); | 108 | LOG (GNUNET_ERROR_TYPE_INFO, " hello for %s (%d bytes), expires on %s\n", |
109 | GNUNET_i2s (id), NULL != hello ? GNUNET_HELLO_size (hello) : -1, | ||
110 | GNUNET_STRINGS_absolute_time_to_string(GNUNET_HELLO_get_last_expiration(hello))); | ||
109 | if (NULL == hello) | 111 | if (NULL == hello) |
110 | { | 112 | { |
111 | LOG (GNUNET_ERROR_TYPE_DEBUG, " hello is NULL\n"); | 113 | LOG (GNUNET_ERROR_TYPE_DEBUG, " hello is NULL\n"); |
@@ -115,7 +117,10 @@ got_hello (void *cls, const struct GNUNET_PeerIdentity *id, | |||
115 | GMP_set_hello (peer, hello); | 117 | GMP_set_hello (peer, hello); |
116 | 118 | ||
117 | if (GMP_get_short_id (peer) == myid) | 119 | if (GMP_get_short_id (peer) == myid) |
118 | mine = hello; | 120 | { |
121 | mine = GMP_get_hello (peer); | ||
122 | LOG (GNUNET_ERROR_TYPE_DEBUG, " updated mine to %p\n", mine); | ||
123 | } | ||
119 | } | 124 | } |
120 | 125 | ||
121 | 126 | ||
@@ -165,6 +170,7 @@ GMH_shutdown () | |||
165 | const struct GNUNET_HELLO_Message * | 170 | const struct GNUNET_HELLO_Message * |
166 | GMH_get_mine (void) | 171 | GMH_get_mine (void) |
167 | { | 172 | { |
173 | LOG (GNUNET_ERROR_TYPE_DEBUG, " mine is %p\n", mine); | ||
168 | return mine; | 174 | return mine; |
169 | } | 175 | } |
170 | 176 | ||
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) | |||
1888 | struct GNUNET_HELLO_Message *old; | 1888 | struct GNUNET_HELLO_Message *old; |
1889 | size_t size; | 1889 | size_t size; |
1890 | 1890 | ||
1891 | LOG (GNUNET_ERROR_TYPE_DEBUG, "New hello for %s\n", GMP_2s (peer)); | ||
1891 | if (NULL == hello) | 1892 | if (NULL == hello) |
1892 | return; | 1893 | return; |
1893 | 1894 | ||
1894 | old = GMP_get_hello (peer); | 1895 | old = GMP_get_hello (peer); |
1896 | LOG (GNUNET_ERROR_TYPE_DEBUG, " old hello %p\n", old); | ||
1895 | if (NULL == old) | 1897 | if (NULL == old) |
1896 | { | 1898 | { |
1897 | size = GNUNET_HELLO_size (hello); | 1899 | size = GNUNET_HELLO_size (hello); |
1900 | LOG (GNUNET_ERROR_TYPE_DEBUG, " new size: %u\n", size); | ||
1898 | peer->hello = GNUNET_malloc (size); | 1901 | peer->hello = GNUNET_malloc (size); |
1899 | memcpy (peer->hello, hello, size); | 1902 | memcpy (peer->hello, hello, size); |
1900 | return; | ||
1901 | } | 1903 | } |
1902 | else | 1904 | else |
1903 | { | 1905 | { |
1904 | peer->hello = GNUNET_HELLO_merge (old, hello); | 1906 | peer->hello = GNUNET_HELLO_merge (old, hello); |
1907 | LOG (GNUNET_ERROR_TYPE_DEBUG, " merge! %p\n", peer->hello); | ||
1905 | GNUNET_free (old); | 1908 | GNUNET_free (old); |
1906 | } | 1909 | } |
1907 | } | 1910 | } |
@@ -1920,6 +1923,7 @@ GMP_get_hello (struct MeshPeer *peer) | |||
1920 | struct GNUNET_TIME_Absolute expiration; | 1923 | struct GNUNET_TIME_Absolute expiration; |
1921 | struct GNUNET_TIME_Relative remaining; | 1924 | struct GNUNET_TIME_Relative remaining; |
1922 | 1925 | ||
1926 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Get hello\n"); | ||
1923 | if (NULL == peer->hello) | 1927 | if (NULL == peer->hello) |
1924 | return NULL; | 1928 | return NULL; |
1925 | 1929 | ||
@@ -1927,6 +1931,8 @@ GMP_get_hello (struct MeshPeer *peer) | |||
1927 | remaining = GNUNET_TIME_absolute_get_remaining (expiration); | 1931 | remaining = GNUNET_TIME_absolute_get_remaining (expiration); |
1928 | if (0 == remaining.rel_value_us) | 1932 | if (0 == remaining.rel_value_us) |
1929 | { | 1933 | { |
1934 | LOG (GNUNET_ERROR_TYPE_DEBUG, " expired on %s\n", | ||
1935 | GNUNET_STRINGS_absolute_time_to_string (expiration)); | ||
1930 | GNUNET_free (peer->hello); | 1936 | GNUNET_free (peer->hello); |
1931 | peer->hello = NULL; | 1937 | peer->hello = NULL; |
1932 | } | 1938 | } |