gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r18138 - gnunet/src/mesh
Date: Mon, 14 Nov 2011 18:27:00 +0100

Author: bartpolot
Date: 2011-11-14 18:27:00 +0100 (Mon, 14 Nov 2011)
New Revision: 18138

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
Log:
Add info about peer's paths on ACK of a path


Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2011-11-14 17:11:36 UTC (rev 
18137)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2011-11-14 17:27:00 UTC (rev 
18138)
@@ -1521,6 +1521,12 @@
     path_destroy (path);
     return;
   }
+  if (path->peers[path->length - 1] != peer_info->id)
+  {
+    GNUNET_break (0);
+    path_destroy (path);
+    return;
+  }
   if (path->length <= 2 && GNUNET_NO == trusted)
   {
     /* Only allow CORE to tell us about direct paths */
@@ -3047,7 +3053,9 @@
   struct GNUNET_MESH_PathACK *msg;
   struct GNUNET_PeerIdentity id;
   struct MeshPeerInfo *peer_info;
+  struct MeshPeerPath *p;
   struct MeshTunnel *t;
+  unsigned int i;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Received a path ACK msg [%s]\n",
               GNUNET_i2s (&my_full_id));
@@ -3059,6 +3067,21 @@
     return GNUNET_OK;
   }
 
+  /* Add paths to peers */
+  peer_info = peer_info_get (&msg->peer_id);
+  p = tree_get_path_to_peer(t->tree, peer_info->id);
+  for (i = 1; i < p->length && p->peers[i] != myid; i++) /* skip'em */;
+  for (i++; i < p->length; i++)
+  {
+    struct MeshPeerInfo *aux;
+    struct MeshPeerPath *copy;
+
+    aux = peer_info_get_short(p->peers[i]);
+    copy = path_duplicate(p);
+    copy->length = i;
+    peer_info_add_path(aux, copy, 0);
+  }
+
   /* Message for us? */
   if (0 == memcmp (&msg->oid, &my_full_id, sizeof (struct 
GNUNET_PeerIdentity)))
   {
@@ -3073,7 +3096,6 @@
       GNUNET_DHT_get_stop (t->dht_get_type);
       t->dht_get_type = NULL;
     }
-    peer_info = peer_info_get (&msg->peer_id);
     if (tree_get_status(t->tree, peer_info->id) != MESH_PEER_READY)
     {
       tree_set_status (t->tree, peer_info->id, MESH_PEER_READY);




reply via email to

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