From: Bart Polot Date: Wed, 27 Nov 2013 05:08:55 +0000 (+0000) Subject: - fix consensus profiler test (multiple channels reusing same tunnel/session) X-Git-Tag: initial-import-from-subversion-38251~5933 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4826fe4d5b69e0db9313e06a2a00179a998fb6e7;p=oweals%2Fgnunet.git - fix consensus profiler test (multiple channels reusing same tunnel/session) --- diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index 35502f8c7..e33a9e23b 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c @@ -2270,7 +2270,9 @@ GMC_get_id (const struct MeshConnection *c) const struct MeshPeerPath * GMC_get_path (const struct MeshConnection *c) { - return c->path; + if (GNUNET_NO == c->destroy) + return c->path; + return NULL; } diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c index 1679e2e66..967bd1712 100644 --- a/src/mesh/gnunet-service-mesh_peer.c +++ b/src/mesh/gnunet-service-mesh_peer.c @@ -1336,6 +1336,11 @@ GMP_connect (struct MeshPeer *peer) return; } } + else + { + LOG (GNUNET_ERROR_TYPE_DEBUG, "but is NULL!!\n"); + GNUNET_break (0); + } } if (NULL != peer->search_h && GNUNET_YES == rerun_search) diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 0d589acf4..eaf21dbf0 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c @@ -1642,6 +1642,12 @@ GMT_add_channel (struct MeshTunnel3 *t, struct MeshChannel *ch) aux->ch = ch; LOG (GNUNET_ERROR_TYPE_DEBUG, " adding %p to %p\n", aux, t->channel_head); GNUNET_CONTAINER_DLL_insert_tail (t->channel_head, t->channel_tail, aux); + + if (GNUNET_YES == t->destroy) + { + t->destroy = GNUNET_NO; + LOG (GNUNET_ERROR_TYPE_DEBUG, " undo destroy!\n"); + } } @@ -2274,6 +2280,7 @@ GMT_get_path_cost (const struct MeshTunnel3 *t, const struct MeshPeerPath *path) { struct MeshTConnection *iter; + const struct MeshPeerPath *aux; unsigned int overlap; unsigned int i; unsigned int j; @@ -2288,9 +2295,13 @@ GMT_get_path_cost (const struct MeshTunnel3 *t, { for (iter = t->connection_head; NULL != iter; iter = iter->next) { - for (j = 0; j < GMC_get_path (iter->c)->length; j++) + aux = GMC_get_path (iter->c); + if (NULL == aux) + continue; + + for (j = 0; j < aux->length; j++) { - if (path->peers[i] == GMC_get_path (iter->c)->peers[j]) + if (path->peers[i] == aux->peers[j]) { overlap++; break;