size_t size_needed;
int i;
+ if (NULL == p)
+ return 0;
+
LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending CONNECTION CREATE...\n");
size_needed =
sizeof (struct GNUNET_MESH_ConnectionCreate) +
/**
- * Choose the best path towards a peer considering the tunnel properties.
+ * Choose the best (yet unused) path towards a peer,
+ * considering the tunnel properties.
*
* @param peer The destination peer.
*
struct MeshConnection *c;
int rerun_search;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "peer_connect towards %s\n",
- GMP_2s (peer));
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "peer_connect towards %s\n", GMP_2s (peer));
t = peer->tunnel;
c = NULL;
rerun_search = GNUNET_NO;
* path.
*
* Re-running the DHT GET should give core time to callback.
+ *
+ * GMT_use_path -> GMC_new -> register_neighbors takes care of
+ * updating statistics about this issue.
*/
- GNUNET_break(0);
- rerun_search = GNUNET_YES;
+ rerun_search = GNUNET_YES;
}
else
{
}
+/**
+ * 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. Is always destroyed .
+ */
+void
+GMP_remove_path (struct MeshPeer *peer, struct MeshPeerPath *path)
+{
+ struct MeshPeerPath *iter;
+ struct MeshPeerPath *next;
+
+ GNUNET_assert (myid == path->peers[0]);
+ GNUNET_assert (peer->id == 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))
+ {
+ GNUNET_CONTAINER_DLL_remove (peer->path_head, peer->path_tail, iter);
+ path_destroy (iter);
+ if (path == iter)
+ return;
+ }
+ }
+ path_destroy (path);
+}
+
+
/**
* Remove a connection from a neighboring peer.
*
{
if (NULL == peer || NULL == peer->connections)
{
- GNUNET_break (0);
- LOG (GNUNET_ERROR_TYPE_WARNING,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Peer %s is not a neighbor!\n",
GMP_2s (peer));
return GNUNET_SYSERR;
struct MeshTunnel3 *
GMP_get_tunnel (const struct MeshPeer *peer)
{
+ GNUNET_assert (NULL != peer->tunnel);
return peer->tunnel;
}