Small fix, improved comment
[oweals/gnunet.git] / src / mesh / gnunet-service-mesh.c
index a5113e52b9580f8f2774312fb6b124cf437a721e..e3a8b3f0e2f968af64671fcf6a816fc1d64c9dc2 100644 (file)
@@ -1158,6 +1158,7 @@ send_message (const struct GNUNET_MessageHeader *message,
   if (NULL == p)
   {
     GNUNET_break (0);
+    GNUNET_free (info);
     return;
   }
   i = peer_info_transmit_slot (neighbor);
@@ -1448,6 +1449,7 @@ peer_info_remove_path (struct MeshPeerInfo *peer, GNUNET_PEER_Id p1,
   for (i = 0; i < peer->ntunnels; i++)
   {
     d = tunnel_notify_connection_broken (peer->tunnels[i], p1, p2);
+    if (0 == d) continue;
     /* TODO
      * Problem: one or more peers have been deleted from the tunnel tree.
      * We don't know who they are to try to add them again.
@@ -1472,7 +1474,9 @@ peer_info_remove_path (struct MeshPeerInfo *peer, GNUNET_PEER_Id p1,
     }
     if (NULL != aux)
     {
-      /* No callback, as peer will be already disconnected */
+      /* No callback, as peer will be already disconnected and a connection
+       * scheduled by tunnel_notify_connection_broken.
+       */
       tree_add_path (peer->tunnels[i]->tree, aux, NULL, NULL);
     }
     else
@@ -1518,7 +1522,7 @@ peer_info_add_path (struct MeshPeerInfo *peer_info, struct MeshPeerPath *path,
     if (path->peers[l] == myid)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: shortening path by %u\n", l);
-      for (l2 = 0; l2 < path->length - l - 1; l2++)
+      for (l2 = 0; l2 < path->length - l; l2++)
       {
         path->peers[l2] = path->peers[l + l2];
       }