From: Bart Polot Date: Mon, 17 Oct 2011 16:43:24 +0000 (+0000) Subject: Added debug info for multicast X-Git-Tag: initial-import-from-subversion-38251~16452 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=27f9286f3ad311c5aa0463fdbb87dd56fe09b03f;p=oweals%2Fgnunet.git Added debug info for multicast --- 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, size_t size; void *data; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "MESH: sending a multicast packet...\n"); size = ntohs (msg->size); GNUNET_assert (NULL != t->tree->me); n = t->tree->me->children_head; @@ -1643,6 +1645,7 @@ tunnel_send_multicast (struct MeshTunnel *t, copies = GNUNET_malloc (sizeof (unsigned int)); for (*copies = 0; NULL != n; n = n->next) (*copies)++; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: (%u copies)\n", copies); n = t->tree->me->children_head; data = GNUNET_malloc (size); memcpy (data, &msg, size); @@ -1663,6 +1666,9 @@ tunnel_send_multicast (struct MeshTunnel *t, } info->destination = n->peer; neighbor = path_get_first_hop(t->tree, n->peer); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "MESH: sending to %s...\n", + GNUNET_i2s (neighbor)); info->peer = peer_info_get(neighbor); GNUNET_assert (NULL != info->peer); 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, struct MeshTunnel *t; size_t size; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "MESH: got a multicast packet from %s\n", + GNUNET_i2s (peer)); size = ntohs (message->size) - sizeof (struct GNUNET_MESH_Multicast); if (size < sizeof (struct GNUNET_MessageHeader)) { @@ -3540,6 +3549,9 @@ handle_local_multicast (void *cls, struct GNUNET_SERVER_Client *client, struct GNUNET_MESH_Multicast *data_msg; MESH_TunnelNumber tid; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "MESH: Got a multicast request from a client!\n"); + /* Sanity check for client registration */ if (NULL == (c = client_get (client))) { @@ -3582,10 +3594,12 @@ handle_local_multicast (void *cls, struct GNUNET_SERVER_Client *client, memcpy(buf, message, ntohs(message->size)); copy->oid = my_full_id; copy->tid = htonl(t->id.tid); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "MESH: calling generic handler...\n"); handle_mesh_data_multicast(client, &my_full_id, ©->header, NULL); } - /* receive done gets called when last copy is sent */ + /* receive done gets called when last copy is sent to a neighbor */ return; } 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) tsize = 0; while ((NULL != (th = h->th_head)) && (size >= th->size)) { -#if DEBUG - LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: type: %u\n", - ntohs (((struct GNUNET_MessageHeader *) &th[1])->type)); - LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: size: %u\n", - ntohs (((struct GNUNET_MessageHeader *) &th[1])->size)); -#endif if (NULL != th->notify) { if (th->tunnel->tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV) @@ -1076,6 +1070,9 @@ send_callback (void *cls, size_t size, void *buf) GNUNET_assert (size >= th->size); psize = th->notify (th->notify_cls, size - sizeof (mc), &cbuf[sizeof (mc)]); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "mesh: multicast, type %u\n", + ntohs (mh->type)); if (psize > 0) { mc.header.size = htons (sizeof (mc) + th->size); @@ -1468,12 +1465,17 @@ GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Tunnel *tunnel, int cork, uint32_t least_priority; size_t overhead; +#if DEBUG GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: mesh notify transmit ready called\n"); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "mesh: target %s\n", - GNUNET_i2s (target)); - + if (NULL != target) + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "mesh: target %s\n", + GNUNET_i2s (target)); + else + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "mesh: target multicast\n"); +#endif GNUNET_assert (NULL != notify); if (tunnel->mesh->npackets >= tunnel->mesh->max_queue_size && 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, void **tunnel_ctx, const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *message, - const struct GNUNET_TRANSPORT_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi) { long client = (long) cls; @@ -293,7 +293,7 @@ static void * incoming_tunnel (void *cls, struct GNUNET_MESH_Tunnel * tunnel, const struct GNUNET_PeerIdentity * initiator, - const struct GNUNET_TRANSPORT_ATS_Information * atsi) + const struct GNUNET_ATS_Information * atsi) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Incoming tunnel from %s\n", @@ -353,7 +353,7 @@ dh (void *cls, const struct GNUNET_PeerIdentity *peer) */ static void ch (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_TRANSPORT_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer %s connected\n",