diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-11-14 17:06:42 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-11-14 17:06:42 +0000 |
commit | 41323384c6bc36f5713cce594258110144d261ef (patch) | |
tree | d83bae5fc0cc2de33c1f9bd8765bc77d910014b9 /src/mesh/gnunet-service-mesh.c | |
parent | a2dbac31f9731bb72a6d13522545e5e75fdd8d4a (diff) | |
download | gnunet-41323384c6bc36f5713cce594258110144d261ef.tar.gz gnunet-41323384c6bc36f5713cce594258110144d261ef.zip |
Real implementation for getting cost of a path compared to an existing tunnel tree (additional hops)
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 14dd5d1fd..bcf6a400b 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -1477,7 +1477,7 @@ peer_info_remove_path (struct MeshPeerInfo *peer, GNUNET_PEER_Id p1, | |||
1477 | aux = NULL; | 1477 | aux = NULL; |
1478 | for (p = peer_d->path_head; NULL != p; p = p->next) | 1478 | for (p = peer_d->path_head; NULL != p; p = p->next) |
1479 | { | 1479 | { |
1480 | if ((cost = path_get_cost (peer->tunnels[i]->tree, p)) < best) | 1480 | if ((cost = tree_get_path_cost (peer->tunnels[i]->tree, p)) < best) |
1481 | { | 1481 | { |
1482 | best = cost; | 1482 | best = cost; |
1483 | aux = p; | 1483 | aux = p; |
@@ -1848,10 +1848,10 @@ tunnel_add_peer (struct MeshTunnel *t, struct MeshPeerInfo *peer) | |||
1848 | if (NULL != (p = peer->path_head)) | 1848 | if (NULL != (p = peer->path_head)) |
1849 | { | 1849 | { |
1850 | best_p = p; | 1850 | best_p = p; |
1851 | best_cost = path_get_cost (t->tree, p); | 1851 | best_cost = tree_get_path_cost (t->tree, p); |
1852 | while (NULL != p) | 1852 | while (NULL != p) |
1853 | { | 1853 | { |
1854 | if ((cost = path_get_cost (t->tree, p)) < best_cost) | 1854 | if ((cost = tree_get_path_cost (t->tree, p)) < best_cost) |
1855 | { | 1855 | { |
1856 | best_cost = cost; | 1856 | best_cost = cost; |
1857 | best_p = p; | 1857 | best_p = p; |
@@ -1865,7 +1865,7 @@ tunnel_add_peer (struct MeshTunnel *t, struct MeshPeerInfo *peer) | |||
1865 | } | 1865 | } |
1866 | else | 1866 | else |
1867 | { | 1867 | { |
1868 | /* Start a DHT get if necessary */ | 1868 | /* Start a DHT get */ |
1869 | peer_info_connect (peer, t); | 1869 | peer_info_connect (peer, t); |
1870 | } | 1870 | } |
1871 | } | 1871 | } |
@@ -3253,8 +3253,6 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp, | |||
3253 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Got results from DHT!\n"); | 3253 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Got results from DHT!\n"); |
3254 | GNUNET_PEER_resolve (path_info->peer->id, &pi); | 3254 | GNUNET_PEER_resolve (path_info->peer->id, &pi); |
3255 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: for %s\n", GNUNET_i2s (&pi)); | 3255 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: for %s\n", GNUNET_i2s (&pi)); |
3256 | // GNUNET_DHT_get_stop(path_info->peer->dhtget); | ||
3257 | // path_info->peer->dhtget = NULL; | ||
3258 | 3256 | ||
3259 | p = path_build_from_dht (get_path, get_path_length, put_path, | 3257 | p = path_build_from_dht (get_path, get_path_length, put_path, |
3260 | put_path_length); | 3258 | put_path_length); |
@@ -3264,7 +3262,6 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp, | |||
3264 | tunnel_add_peer (path_info->peer->tunnels[i], path_info->peer); | 3262 | tunnel_add_peer (path_info->peer->tunnels[i], path_info->peer); |
3265 | peer_info_connect (path_info->peer, path_info->t); | 3263 | peer_info_connect (path_info->peer, path_info->t); |
3266 | } | 3264 | } |
3267 | // GNUNET_free (path_info); | ||
3268 | 3265 | ||
3269 | return; | 3266 | return; |
3270 | } | 3267 | } |