diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-10-31 16:27:32 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-10-31 16:27:32 +0000 |
commit | a38370ae1e835d9ad452788ad1fc6424926fe31c (patch) | |
tree | 22717591215df7aa43bf38e01ee6eb0a5d0a9842 /src/mesh | |
parent | 1c9a990d0f0f213f87957a9d43f36c425d2c916a (diff) | |
download | gnunet-a38370ae1e835d9ad452788ad1fc6424926fe31c.tar.gz gnunet-a38370ae1e835d9ad452788ad1fc6424926fe31c.zip |
Dont add whole path to peer, just the relevant part
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index ca60433de..9b76e6b1e 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -1509,18 +1509,34 @@ path_add_to_peer (struct MeshPeerInfo *peer_info, struct MeshPeerPath *path) | |||
1509 | path_destroy (path); | 1509 | path_destroy (path); |
1510 | return; | 1510 | return; |
1511 | } | 1511 | } |
1512 | for (l = 1; l < path->length; l++) | ||
1513 | { | ||
1514 | if (path->peers[l] == myid) | ||
1515 | { | ||
1516 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1517 | "MESH: shortening path by %u\n", | ||
1518 | l); | ||
1519 | for (l2 = 0; l2 < path->length - l - 1 ; l2++) | ||
1520 | { | ||
1521 | path->peers[l2] = path->peers[l + l2]; | ||
1522 | } | ||
1523 | path->length -= l; | ||
1524 | l = 0; | ||
1525 | path->peers = GNUNET_realloc (path->peers, | ||
1526 | path->length * sizeof (GNUNET_PEER_Id)); | ||
1527 | } | ||
1528 | } | ||
1512 | #if MESH_DEBUG | 1529 | #if MESH_DEBUG |
1513 | { | 1530 | { |
1514 | struct GNUNET_PeerIdentity id; | 1531 | struct GNUNET_PeerIdentity id; |
1515 | 1532 | ||
1516 | GNUNET_PEER_resolve (peer_info->id, &id); | 1533 | GNUNET_PEER_resolve (peer_info->id, &id); |
1517 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1534 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1518 | "MESH: adding path [%u] to peer %s\n", | 1535 | "MESH: adding path [%u] to peer %s\n", |
1519 | path->length, | 1536 | path->length, |
1520 | GNUNET_i2s (&id)); | 1537 | GNUNET_i2s (&id)); |
1521 | } | 1538 | } |
1522 | #endif | 1539 | #endif |
1523 | |||
1524 | l = path_get_length (path); | 1540 | l = path_get_length (path); |
1525 | if (0 == l) | 1541 | if (0 == l) |
1526 | { | 1542 | { |