diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-10-17 16:43:24 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-10-17 16:43:24 +0000 |
commit | 27f9286f3ad311c5aa0463fdbb87dd56fe09b03f (patch) | |
tree | f676aca9911355eb24a0b8bbb3f392aff5ea6556 /src/mesh | |
parent | faae173a9a2190c3af44c5fe1f79937bfa9dd82d (diff) | |
download | gnunet-27f9286f3ad311c5aa0463fdbb87dd56fe09b03f.tar.gz gnunet-27f9286f3ad311c5aa0463fdbb87dd56fe09b03f.zip |
Added debug info for multicast
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 16 | ||||
-rw-r--r-- | src/mesh/mesh_api_new.c | 22 | ||||
-rw-r--r-- | src/mesh/test_mesh_small_multicast.c | 6 |
3 files changed, 30 insertions, 14 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 97f0f985b..d54a7022f 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -1635,6 +1635,8 @@ tunnel_send_multicast (struct MeshTunnel *t, | |||
1635 | size_t size; | 1635 | size_t size; |
1636 | void *data; | 1636 | void *data; |
1637 | 1637 | ||
1638 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1639 | "MESH: sending a multicast packet...\n"); | ||
1638 | size = ntohs (msg->size); | 1640 | size = ntohs (msg->size); |
1639 | GNUNET_assert (NULL != t->tree->me); | 1641 | GNUNET_assert (NULL != t->tree->me); |
1640 | n = t->tree->me->children_head; | 1642 | n = t->tree->me->children_head; |
@@ -1643,6 +1645,7 @@ tunnel_send_multicast (struct MeshTunnel *t, | |||
1643 | copies = GNUNET_malloc (sizeof (unsigned int)); | 1645 | copies = GNUNET_malloc (sizeof (unsigned int)); |
1644 | for (*copies = 0; NULL != n; n = n->next) | 1646 | for (*copies = 0; NULL != n; n = n->next) |
1645 | (*copies)++; | 1647 | (*copies)++; |
1648 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: (%u copies)\n", copies); | ||
1646 | n = t->tree->me->children_head; | 1649 | n = t->tree->me->children_head; |
1647 | data = GNUNET_malloc (size); | 1650 | data = GNUNET_malloc (size); |
1648 | memcpy (data, &msg, size); | 1651 | memcpy (data, &msg, size); |
@@ -1663,6 +1666,9 @@ tunnel_send_multicast (struct MeshTunnel *t, | |||
1663 | } | 1666 | } |
1664 | info->destination = n->peer; | 1667 | info->destination = n->peer; |
1665 | neighbor = path_get_first_hop(t->tree, n->peer); | 1668 | neighbor = path_get_first_hop(t->tree, n->peer); |
1669 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1670 | "MESH: sending to %s...\n", | ||
1671 | GNUNET_i2s (neighbor)); | ||
1666 | info->peer = peer_info_get(neighbor); | 1672 | info->peer = peer_info_get(neighbor); |
1667 | GNUNET_assert (NULL != info->peer); | 1673 | GNUNET_assert (NULL != info->peer); |
1668 | for (i = 0; NULL != info->peer->core_transmit[i]; i++) | 1674 | for (i = 0; NULL != info->peer->core_transmit[i]; i++) |
@@ -2360,6 +2366,9 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2360 | struct MeshTunnel *t; | 2366 | struct MeshTunnel *t; |
2361 | size_t size; | 2367 | size_t size; |
2362 | 2368 | ||
2369 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2370 | "MESH: got a multicast packet from %s\n", | ||
2371 | GNUNET_i2s (peer)); | ||
2363 | size = ntohs (message->size) - sizeof (struct GNUNET_MESH_Multicast); | 2372 | size = ntohs (message->size) - sizeof (struct GNUNET_MESH_Multicast); |
2364 | if (size < sizeof (struct GNUNET_MessageHeader)) | 2373 | if (size < sizeof (struct GNUNET_MessageHeader)) |
2365 | { | 2374 | { |
@@ -3540,6 +3549,9 @@ handle_local_multicast (void *cls, struct GNUNET_SERVER_Client *client, | |||
3540 | struct GNUNET_MESH_Multicast *data_msg; | 3549 | struct GNUNET_MESH_Multicast *data_msg; |
3541 | MESH_TunnelNumber tid; | 3550 | MESH_TunnelNumber tid; |
3542 | 3551 | ||
3552 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3553 | "MESH: Got a multicast request from a client!\n"); | ||
3554 | |||
3543 | /* Sanity check for client registration */ | 3555 | /* Sanity check for client registration */ |
3544 | if (NULL == (c = client_get (client))) | 3556 | if (NULL == (c = client_get (client))) |
3545 | { | 3557 | { |
@@ -3582,10 +3594,12 @@ handle_local_multicast (void *cls, struct GNUNET_SERVER_Client *client, | |||
3582 | memcpy(buf, message, ntohs(message->size)); | 3594 | memcpy(buf, message, ntohs(message->size)); |
3583 | copy->oid = my_full_id; | 3595 | copy->oid = my_full_id; |
3584 | copy->tid = htonl(t->id.tid); | 3596 | copy->tid = htonl(t->id.tid); |
3597 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3598 | "MESH: calling generic handler...\n"); | ||
3585 | handle_mesh_data_multicast(client, &my_full_id, ©->header, NULL); | 3599 | handle_mesh_data_multicast(client, &my_full_id, ©->header, NULL); |
3586 | } | 3600 | } |
3587 | 3601 | ||
3588 | /* receive done gets called when last copy is sent */ | 3602 | /* receive done gets called when last copy is sent to a neighbor */ |
3589 | return; | 3603 | return; |
3590 | } | 3604 | } |
3591 | 3605 | ||
diff --git a/src/mesh/mesh_api_new.c b/src/mesh/mesh_api_new.c index fda4e916f..b3037e562 100644 --- a/src/mesh/mesh_api_new.c +++ b/src/mesh/mesh_api_new.c | |||
@@ -1036,12 +1036,6 @@ send_callback (void *cls, size_t size, void *buf) | |||
1036 | tsize = 0; | 1036 | tsize = 0; |
1037 | while ((NULL != (th = h->th_head)) && (size >= th->size)) | 1037 | while ((NULL != (th = h->th_head)) && (size >= th->size)) |
1038 | { | 1038 | { |
1039 | #if DEBUG | ||
1040 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: type: %u\n", | ||
1041 | ntohs (((struct GNUNET_MessageHeader *) &th[1])->type)); | ||
1042 | LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: size: %u\n", | ||
1043 | ntohs (((struct GNUNET_MessageHeader *) &th[1])->size)); | ||
1044 | #endif | ||
1045 | if (NULL != th->notify) | 1039 | if (NULL != th->notify) |
1046 | { | 1040 | { |
1047 | if (th->tunnel->tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV) | 1041 | if (th->tunnel->tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV) |
@@ -1076,6 +1070,9 @@ send_callback (void *cls, size_t size, void *buf) | |||
1076 | GNUNET_assert (size >= th->size); | 1070 | GNUNET_assert (size >= th->size); |
1077 | psize = | 1071 | psize = |
1078 | th->notify (th->notify_cls, size - sizeof (mc), &cbuf[sizeof (mc)]); | 1072 | th->notify (th->notify_cls, size - sizeof (mc), &cbuf[sizeof (mc)]); |
1073 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1074 | "mesh: multicast, type %u\n", | ||
1075 | ntohs (mh->type)); | ||
1079 | if (psize > 0) | 1076 | if (psize > 0) |
1080 | { | 1077 | { |
1081 | mc.header.size = htons (sizeof (mc) + th->size); | 1078 | mc.header.size = htons (sizeof (mc) + th->size); |
@@ -1468,12 +1465,17 @@ GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Tunnel *tunnel, int cork, | |||
1468 | uint32_t least_priority; | 1465 | uint32_t least_priority; |
1469 | size_t overhead; | 1466 | size_t overhead; |
1470 | 1467 | ||
1468 | #if DEBUG | ||
1471 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1469 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1472 | "mesh: mesh notify transmit ready called\n"); | 1470 | "mesh: mesh notify transmit ready called\n"); |
1473 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1471 | if (NULL != target) |
1474 | "mesh: target %s\n", | 1472 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1475 | GNUNET_i2s (target)); | 1473 | "mesh: target %s\n", |
1476 | 1474 | GNUNET_i2s (target)); | |
1475 | else | ||
1476 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1477 | "mesh: target multicast\n"); | ||
1478 | #endif | ||
1477 | GNUNET_assert (NULL != notify); | 1479 | GNUNET_assert (NULL != notify); |
1478 | if (tunnel->mesh->npackets >= tunnel->mesh->max_queue_size && | 1480 | if (tunnel->mesh->npackets >= tunnel->mesh->max_queue_size && |
1479 | tunnel->npackets > 0) | 1481 | tunnel->npackets > 0) |
diff --git a/src/mesh/test_mesh_small_multicast.c b/src/mesh/test_mesh_small_multicast.c index 837942de6..f9b69506e 100644 --- a/src/mesh/test_mesh_small_multicast.c +++ b/src/mesh/test_mesh_small_multicast.c | |||
@@ -231,7 +231,7 @@ data_callback (void *cls, | |||
231 | void **tunnel_ctx, | 231 | void **tunnel_ctx, |
232 | const struct GNUNET_PeerIdentity *sender, | 232 | const struct GNUNET_PeerIdentity *sender, |
233 | const struct GNUNET_MessageHeader *message, | 233 | const struct GNUNET_MessageHeader *message, |
234 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 234 | const struct GNUNET_ATS_Information *atsi) |
235 | { | 235 | { |
236 | long client = (long) cls; | 236 | long client = (long) cls; |
237 | 237 | ||
@@ -293,7 +293,7 @@ static void * | |||
293 | incoming_tunnel (void *cls, | 293 | incoming_tunnel (void *cls, |
294 | struct GNUNET_MESH_Tunnel * tunnel, | 294 | struct GNUNET_MESH_Tunnel * tunnel, |
295 | const struct GNUNET_PeerIdentity * initiator, | 295 | const struct GNUNET_PeerIdentity * initiator, |
296 | const struct GNUNET_TRANSPORT_ATS_Information * atsi) | 296 | const struct GNUNET_ATS_Information * atsi) |
297 | { | 297 | { |
298 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 298 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
299 | "test: Incoming tunnel from %s\n", | 299 | "test: Incoming tunnel from %s\n", |
@@ -353,7 +353,7 @@ dh (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
353 | */ | 353 | */ |
354 | static void | 354 | static void |
355 | ch (void *cls, const struct GNUNET_PeerIdentity *peer, | 355 | ch (void *cls, const struct GNUNET_PeerIdentity *peer, |
356 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 356 | const struct GNUNET_ATS_Information *atsi) |
357 | { | 357 | { |
358 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 358 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
359 | "test: peer %s connected\n", | 359 | "test: peer %s connected\n", |