- Off by 1
authorBart Polot <bart@net.in.tum.de>
Mon, 28 Nov 2011 18:27:23 +0000 (18:27 +0000)
committerBart Polot <bart@net.in.tum.de>
Mon, 28 Nov 2011 18:27:23 +0000 (18:27 +0000)
src/mesh/gnunet-service-mesh.c

index ce90b224cb0c947216a889e3798f0d0217490249..8883602ab6a47c97922a4dad0b9e210987c68db7 100644 (file)
@@ -1709,7 +1709,7 @@ path_add_to_peers (struct MeshPeerPath *p, int confirmed)
   unsigned int i;
 
   /* TODO: invert and add */
-  for (i = 1; i < p->length && p->peers[i] != myid; i++) /* skip'em */;
+  for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */;
   for (i++; i < p->length; i++)
   {
     struct MeshPeerInfo *aux;
@@ -1717,7 +1717,7 @@ path_add_to_peers (struct MeshPeerPath *p, int confirmed)
 
     aux = peer_info_get_short(p->peers[i]);
     copy = path_duplicate(p);
-    copy->length = i;
+    copy->length = i + 1;
     peer_info_add_path(aux, copy, GNUNET_NO);
   }
 }