-/**
- * Get a cost of a path for a peer considering existing tunnel connections.
- *
- * @param peer Peer towards which the path is considered.
- * @param path Candidate path.
- *
- * @return Cost of the path (path length + number of overlapping nodes)
- */
-static unsigned int
-peer_get_path_cost (const struct MeshPeer *peer,
- const struct MeshPeerPath *path)
-{
- struct MeshConnection *c;
- unsigned int overlap;
- unsigned int i;
- unsigned int j;
-
- if (NULL == path)
- return 0;
-
- overlap = 0;
- GNUNET_assert (NULL != peer->tunnel);
-
- for (i = 0; i < path->length; i++)
- {
- for (c = peer->tunnel->connection_head; NULL != c; c = c->next)
- {
- for (j = 0; j < c->path->length; j++)
- {
- if (path->peers[i] == c->path->peers[j])
- {
- overlap++;
- break;
- }
- }
- }
- }
- return (path->length + overlap) * (path->score * -1);
-}
-
-