diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-06-18 16:11:03 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-06-18 16:11:03 +0000 |
commit | f68c5e63c9bf905e125f449eaa66d9969f74838c (patch) | |
tree | 1de49b904a763b8c44e8f02d7730e21821feeffc /src/dv/plugin_transport_dv.c | |
parent | ab728fdf2db6f2b8cef37d0c6add760c88acd526 (diff) | |
download | gnunet-f68c5e63c9bf905e125f449eaa66d9969f74838c.tar.gz gnunet-f68c5e63c9bf905e125f449eaa66d9969f74838c.zip |
dv changes, better logging and so on
Diffstat (limited to 'src/dv/plugin_transport_dv.c')
-rw-r--r-- | src/dv/plugin_transport_dv.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c index 43bbfad33..c35380bd0 100644 --- a/src/dv/plugin_transport_dv.c +++ b/src/dv/plugin_transport_dv.c | |||
@@ -240,24 +240,7 @@ dv_plugin_send (void *cls, | |||
240 | { | 240 | { |
241 | int ret = 0; | 241 | int ret = 0; |
242 | struct Plugin *plugin = cls; | 242 | struct Plugin *plugin = cls; |
243 | const char *tempbuf; | 243 | |
244 | int temp_size; | ||
245 | #if DEBUG_DV | ||
246 | char *my_identity; | ||
247 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DV API: Received send request from transport, calling GNUNET_DV_send\n"); | ||
248 | my_identity = GNUNET_strdup(GNUNET_i2s(plugin->env->my_identity)); | ||
249 | #endif | ||
250 | temp_size = htons(((struct GNUNET_MessageHeader *)msgbuf)->size); | ||
251 | if (msgbuf_size > temp_size) | ||
252 | { | ||
253 | tempbuf = &msgbuf[temp_size]; | ||
254 | #if DEBUG_DV | ||
255 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s DV PLUGIN SEND SPECIAL type %d to %s\n", my_identity, ntohs(((struct GNUNET_MessageHeader *)tempbuf)->type), GNUNET_i2s(target)); | ||
256 | #endif | ||
257 | } | ||
258 | #if DEBUG_DV | ||
259 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s DV PLUGIN SEND type %d to %s\n", my_identity, ntohs(((struct GNUNET_MessageHeader *)msgbuf)->type), GNUNET_i2s(target)); | ||
260 | #endif | ||
261 | ret = GNUNET_DV_send(plugin->dv_handle, | 244 | ret = GNUNET_DV_send(plugin->dv_handle, |
262 | target, | 245 | target, |
263 | msgbuf, | 246 | msgbuf, |
@@ -287,7 +270,7 @@ dv_plugin_send (void *cls, | |||
287 | */ | 270 | */ |
288 | static void | 271 | static void |
289 | dv_plugin_disconnect (void *cls, | 272 | dv_plugin_disconnect (void *cls, |
290 | const struct GNUNET_PeerIdentity *target) | 273 | const struct GNUNET_PeerIdentity *target) |
291 | { | 274 | { |
292 | // struct Plugin *plugin = cls; | 275 | // struct Plugin *plugin = cls; |
293 | // TODO: Add message type to send to dv service to "disconnect" a peer | 276 | // TODO: Add message type to send to dv service to "disconnect" a peer |
@@ -318,7 +301,25 @@ dv_plugin_address_pretty_printer (void *cls, | |||
318 | GNUNET_TRANSPORT_AddressStringCallback | 301 | GNUNET_TRANSPORT_AddressStringCallback |
319 | asc, void *asc_cls) | 302 | asc, void *asc_cls) |
320 | { | 303 | { |
321 | asc (asc_cls, NULL); | 304 | char *dest_peer; |
305 | char *via_peer; | ||
306 | char *print_string; | ||
307 | char *addr_buf = (char *)addr; | ||
308 | |||
309 | if (addrlen != sizeof(struct GNUNET_PeerIdentity) * 2) | ||
310 | { | ||
311 | asc (asc_cls, NULL); | ||
312 | } | ||
313 | else | ||
314 | { | ||
315 | dest_peer = GNUNET_strdup(GNUNET_i2s((struct GNUNET_PeerIdentity *)addr)); | ||
316 | via_peer = GNUNET_strdup(GNUNET_i2s((struct GNUNET_PeerIdentity *)&addr_buf[sizeof(struct GNUNET_PeerIdentity)])); | ||
317 | GNUNET_asprintf(&print_string, "DV Peer `%s' via peer`%s'", dest_peer, via_peer); | ||
318 | asc (asc_cls, print_string); | ||
319 | asc (asc_cls, NULL); | ||
320 | GNUNET_free(dest_peer); | ||
321 | GNUNET_free(print_string); | ||
322 | } | ||
322 | } | 323 | } |
323 | 324 | ||
324 | /** | 325 | /** |