gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r17267 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r17267 - gnunet/src/mesh
Date: Thu, 6 Oct 2011 22:24:48 +0200

Author: bartpolot
Date: 2011-10-06 22:24:48 +0200 (Thu, 06 Oct 2011)
New Revision: 17267

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
Log:
Added debug info in service

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2011-10-06 19:28:08 UTC (rev 
17266)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2011-10-06 20:24:48 UTC (rev 
17267)
@@ -165,7 +165,7 @@
   struct MeshTunnel **tunnels;
 
     /**
-     * Number of tunnels above
+     * Number of tunnels this peers participates in
      */
   unsigned int ntunnels;
 };
@@ -889,9 +889,12 @@
     }
     else
     {
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+                 "MESH:    Adding from GET: %s.\n",
+                 GNUNET_i2s(&get_path[i]));
       p->length++;
       p->peers = GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) * 
p->length);
-      p->peers[p->length] = id;
+      p->peers[p->length - 1] = id;
     }
   }
   i = put_path_length;
@@ -914,9 +917,12 @@
     }
     else
     {
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+            "MESH:    Adding from PUT: %s.\n",
+            GNUNET_i2s(&put_path[i]));
       p->length++;
       p->peers = GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) * 
p->length);
-      p->peers[p->length] = id;
+      p->peers[p->length - 1] = id;
     }
   }
 #if MESH_DEBUG
@@ -929,6 +935,16 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "MESH:    In total: %d hops\n",
               p->length);
+  for (i = 0; i < p->length; i++)
+  {
+    struct GNUNET_PeerIdentity peer_id;
+
+    GNUNET_PEER_resolve(p->peers[i], &peer_id);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "MESH:        %u: %s\n",
+              p->peers[i],
+              GNUNET_h2s_full(&peer_id.hashPubKey));
+  }
 #endif
   return p;
 }
@@ -1070,6 +1086,7 @@
 /**
  * Add a peer to a tunnel, accomodating paths accordingly and initializing all
  * needed rescources.
+ * If peer already exists, do nothing.
  *
  * @param t Tunnel we want to add a new peer to
  * @param peer PeerInfo of the peer being added
@@ -1112,7 +1129,6 @@
   if (GNUNET_SCHEDULER_NO_TASK == t->path_refresh_task)
     t->path_refresh_task =
         GNUNET_SCHEDULER_add_delayed (t->tree->refresh, &path_refresh, t);
-   
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]