Added debug info for multicast
authorBart Polot <bart@net.in.tum.de>
Mon, 17 Oct 2011 16:43:24 +0000 (16:43 +0000)
committerBart Polot <bart@net.in.tum.de>
Mon, 17 Oct 2011 16:43:24 +0000 (16:43 +0000)
src/mesh/gnunet-service-mesh.c
src/mesh/mesh_api_new.c
src/mesh/test_mesh_small_multicast.c

index 97f0f985b681272bde6b82b81f271c97914674a2..d54a7022f0b41695be73a89c3bab5f299295e350 100644 (file)
@@ -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, &copy->header, NULL);
   }
 
-  /* receive done gets called when last copy is sent */
+  /* receive done gets called when last copy is sent to a neighbor */
   return;
 }
 
index fda4e916f825aed719781546ecf6ea415fb618e4..b3037e56279db423ee7c6292b0f86e3060b375e6 100644 (file)
@@ -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)
index 837942de6f62726e3c58e2896a97590cec868655..f9b69506e21bdf545e2f6d836bc8a4fce89dcffb 100644 (file)
@@ -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",