diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-01-11 11:10:30 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-01-11 11:10:30 +0000 |
commit | 0149bd94fec6b6a9ece88b0747bd0febd02eddf5 (patch) | |
tree | 1a08695a7822c7175f25e84d056212c1c1700d48 /src/peerinfo/peerinfo_api.c | |
parent | 5adacdbe12bf04ce559b695f0af8f863cdae7e85 (diff) | |
download | gnunet-0149bd94fec6b6a9ece88b0747bd0febd02eddf5.tar.gz gnunet-0149bd94fec6b6a9ece88b0747bd0febd02eddf5.zip |
support debugging
Diffstat (limited to 'src/peerinfo/peerinfo_api.c')
-rw-r--r-- | src/peerinfo/peerinfo_api.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index f1fa4845a..b5c6c99d7 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c | |||
@@ -88,6 +88,11 @@ GNUNET_PEERINFO_add_peer (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
88 | uint16_t hs; | 88 | uint16_t hs; |
89 | struct CAFContext *cc; | 89 | struct CAFContext *cc; |
90 | 90 | ||
91 | #if DEBUG_PEERINFO | ||
92 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
93 | "Adding peer `%s' to peerinfo database\n", | ||
94 | GNUNET_i2s(peer)); | ||
95 | #endif | ||
91 | client = GNUNET_CLIENT_connect (sched, "peerinfo", cfg); | 96 | client = GNUNET_CLIENT_connect (sched, "peerinfo", cfg); |
92 | if (client == NULL) | 97 | if (client == NULL) |
93 | { | 98 | { |
@@ -168,6 +173,10 @@ info_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
168 | } | 173 | } |
169 | if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END) | 174 | if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END) |
170 | { | 175 | { |
176 | #if DEBUG_PEERINFO | ||
177 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
178 | "Received end of list of peers from peerinfo database\n"); | ||
179 | #endif | ||
171 | ic->callback (ic->callback_cls, NULL, NULL, 0); | 180 | ic->callback (ic->callback_cls, NULL, NULL, 0); |
172 | GNUNET_CLIENT_disconnect (ic->client); | 181 | GNUNET_CLIENT_disconnect (ic->client); |
173 | GNUNET_free (ic); | 182 | GNUNET_free (ic); |
@@ -197,6 +206,11 @@ info_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
197 | return; | 206 | return; |
198 | } | 207 | } |
199 | } | 208 | } |
209 | #if DEBUG_PEERINFO | ||
210 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
211 | "Received information about peer `%s' from peerinfo database\n", | ||
212 | GNUNET_i2s (&im->peer)); | ||
213 | #endif | ||
200 | ic->callback (ic->callback_cls, &im->peer, hello, ntohl (im->trust)); | 214 | ic->callback (ic->callback_cls, &im->peer, hello, ntohl (im->trust)); |
201 | GNUNET_CLIENT_receive (ic->client, | 215 | GNUNET_CLIENT_receive (ic->client, |
202 | &info_handler, | 216 | &info_handler, |
@@ -243,6 +257,10 @@ GNUNET_PEERINFO_for_all (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
243 | callback (callback_cls, NULL, NULL, 2); | 257 | callback (callback_cls, NULL, NULL, 2); |
244 | return; | 258 | return; |
245 | } | 259 | } |
260 | #if DEBUG_PEERINFO | ||
261 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
262 | "Requesting list of peers from peerinfo database\n"); | ||
263 | #endif | ||
246 | ihc = GNUNET_malloc (sizeof (struct InfoContext) + | 264 | ihc = GNUNET_malloc (sizeof (struct InfoContext) + |
247 | sizeof (struct ListPeerMessage)); | 265 | sizeof (struct ListPeerMessage)); |
248 | ihc->client = client; | 266 | ihc->client = client; |