gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r32721 - gnunet/src/mesh
Date: Fri, 21 Mar 2014 19:44:20 +0100

Author: bartpolot
Date: 2014-03-21 19:44:20 +0100 (Fri, 21 Mar 2014)
New Revision: 32721

Modified:
   gnunet/src/mesh/gnunet-service-mesh_dht.c
   gnunet/src/mesh/mesh_path.c
   gnunet/src/mesh/mesh_path.h
Log:
- dht debug path

Modified: gnunet/src/mesh/gnunet-service-mesh_dht.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_dht.c   2014-03-21 18:44:18 UTC (rev 
32720)
+++ gnunet/src/mesh/gnunet-service-mesh_dht.c   2014-03-21 18:44:20 UTC (rev 
32721)
@@ -223,9 +223,13 @@
   struct GNUNET_HELLO_Message *hello;
   struct MeshPeerPath *p;
   struct MeshPeer *peer;
+  char *s;
 
   p = path_build_from_dht (get_path, get_path_length,
                            put_path, put_path_length);
+  s = path_2s (p);
+  LOG (GNUNET_ERROR_TYPE_INFO, "Got path from DHT: %s\n", s);
+  GNUNET_free_non_null (s);
   peer = GMP_get_short (p->peers[p->length - 1]);
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Got HELLO for %s\n", GMP_2s (peer));
   h->callback (h->cls, p);

Modified: gnunet/src/mesh/mesh_path.c
===================================================================
--- gnunet/src/mesh/mesh_path.c 2014-03-21 18:44:18 UTC (rev 32720)
+++ gnunet/src/mesh/mesh_path.c 2014-03-21 18:44:20 UTC (rev 32721)
@@ -182,6 +182,24 @@
   return GNUNET_OK;
 }
 
+char *
+path_2s (struct MeshPeerPath *p)
+{
+  char *s;
+  char *old;
+  unsigned int i;
+
+  s = old = NULL;
+  for (i = 0; i < p->length; i++)
+  {
+    GNUNET_asprintf (&s, "%s %s",
+                     old, GNUNET_i2s (GNUNET_PEER_resolve2 (p->peers[i])));
+    GNUNET_free_non_null (old);
+    old = s;  old = "";
+  }
+  return s;
+}
+
 void
 path_debug (struct MeshPeerPath *p)
 {

Modified: gnunet/src/mesh/mesh_path.h
===================================================================
--- gnunet/src/mesh/mesh_path.h 2014-03-21 18:44:18 UTC (rev 32720)
+++ gnunet/src/mesh/mesh_path.h 2014-03-21 18:44:20 UTC (rev 32721)
@@ -150,6 +150,13 @@
 int
 path_destroy (struct MeshPeerPath *p);
 
+/**
+ * Path -> allocated one line string. Caller must free.
+ *
+ * @param p Path.
+ */
+char *
+path_2s (struct MeshPeerPath *p);
 
 /**
  * Print info about the path for debug.




reply via email to

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