enum MeshConnectionState state;
/**
- * Path being used for the tunnel.
+ * Path being used for the tunnel. At the origin of the connection
+ * it's a pointer to the destination's path pool, otherwise just a copy.
*/
struct MeshPeerPath *path;
|| GNUNET_NO == GMP_is_neighbor (prev_peer))
{
if (GMC_is_origin (c, GNUNET_YES))
- GNUNET_STATISTICS_update (stats, "# local bad paths", 1, GNUNET_NO);
+ GNUNET_STATISTICS_update (stats, "# local bad paths", 1, GNUNET_NO);
GNUNET_STATISTICS_update (stats, "# bad paths", 1, GNUNET_NO);
LOG (GNUNET_ERROR_TYPE_DEBUG, " register neighbors failed\n");
if (GNUNET_OK != register_neighbors (c))
{
+ if (0 == own_pos)
+ {
+ GMT_remove_path (c->t, p);
+ path_destroy (p);
+ }
GMC_destroy (c);
return NULL;
}
}
+/**
+ * Remove any path to the peer that has the extact same peers as the one given.
+ *
+ * @param peer Peer to remove the path from.
+ * @param path Path to remove.
+ */
+void
+GMP_remove_path (struct MeshPeer *peer, struct MeshPeerPath *path)
+{
+ struct MeshPeerPath *iter;
+ struct MeshPeerPath *next;
+
+ GNUNET_assert (myid == path->peers[path->length - 1]);
+
+ for (iter = peer->path_head; NULL != iter; iter = next)
+ {
+ next = iter->next;
+ if (0 == memcmp (path->peers, iter->peers,
+ sizeof (GNUNET_PEER_Id) * path->length))
+ {
+ path_destroy (iter);
+ }
+ }
+}
+
+
/**
* Remove a connection from a neighboring peer.
*
void
GMP_add_path_to_all (const struct MeshPeerPath *p, int confirmed);
+/**
+ * Remove any path to the peer that has the extact same peers as the one given.
+ *
+ * @param peer Peer to remove the path from.
+ * @param path Path to remove.
+ */
+void
+GMP_remove_path (struct MeshPeer *peer, struct MeshPeerPath *path);
+
/**
* Remove a connection from a neighboring peer.
*
}
+/**
+ * Mark a path as no longer valid for this tunnel: has been tried and failed.
+ *
+ * @param t Tunnel to update.
+ * @param path Invalid path.
+ */
+void
+GMT_remove_path (struct MeshTunnel3 *t, struct MeshPeerPath *path)
+{
+ GMP_remove_path (t->peer, path);
+}
+
+
/**
* Remove a connection from a tunnel.
*
void
GMT_add_connection (struct MeshTunnel3 *t, struct MeshConnection *c);
+/**
+ * Mark a path as no longer valid for this tunnel: has been tried and failed.
+ *
+ * @param t Tunnel to update.
+ * @param path Invalid path.
+ */
+void
+GMT_remove_path (struct MeshTunnel3 *t, struct MeshPeerPath *path);
+
/**
* Remove a connection from a tunnel.
*