From: Bart Polot Date: Mon, 31 Oct 2011 16:27:32 +0000 (+0000) Subject: Dont add whole path to peer, just the relevant part X-Git-Tag: initial-import-from-subversion-38251~16133 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a38370ae1e835d9ad452788ad1fc6424926fe31c;p=oweals%2Fgnunet.git Dont add whole path to peer, just the relevant part --- 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) path_destroy (path); return; } + for (l = 1; l < path->length; l++) + { + if (path->peers[l] == myid) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "MESH: shortening path by %u\n", + l); + for (l2 = 0; l2 < path->length - l - 1 ; l2++) + { + path->peers[l2] = path->peers[l + l2]; + } + path->length -= l; + l = 0; + path->peers = GNUNET_realloc (path->peers, + path->length * sizeof (GNUNET_PEER_Id)); + } + } #if MESH_DEBUG { struct GNUNET_PeerIdentity id; - + GNUNET_PEER_resolve (peer_info->id, &id); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "MESH: adding path [%u] to peer %s\n", - path->length, - GNUNET_i2s (&id)); + "MESH: adding path [%u] to peer %s\n", + path->length, + GNUNET_i2s (&id)); } #endif - l = path_get_length (path); if (0 == l) {