From 42020e0cd21d9999ec08073fe44de7105cbd931f Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Thu, 16 Jan 2014 12:12:12 +0000 Subject: [PATCH] -when tunnel is empty -- don't end connections -- don't stop encryption handshake --- src/mesh/gnunet-service-mesh_tunnel.c | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 110c6d07e..ed556c811 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c @@ -1995,9 +1995,15 @@ static void delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct MeshTunnel3 *t = cls; + struct MeshTConnection *iter; t->destroy_task = GNUNET_SCHEDULER_NO_TASK; t->cstate = MESH_TUNNEL3_SHUTDOWN; + + for (iter = t->connection_head; NULL != iter; iter = iter->next) + { + GMC_send_destroy (iter->c); + } GMT_destroy (t); } @@ -2012,24 +2018,9 @@ delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) void GMT_destroy_empty (struct MeshTunnel3 *t) { - struct MeshTConnection *iter; - LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s empty: destroying scheduled\n", GMT_2s (t)); - for (iter = t->connection_head; NULL != iter; iter = iter->next) - { - GMC_send_destroy (iter->c); - } - if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) - { - t->estate = MESH_TUNNEL3_KEY_UNINITIALIZED; - GNUNET_SCHEDULER_cancel (t->rekey_task); - t->rekey_task = GNUNET_SCHEDULER_NO_TASK; - GNUNET_free (t->kx_ctx); - t->kx_ctx = NULL; - } - t->cstate = MESH_TUNNEL3_NEW; t->destroy_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &delayed_destroy, t); } @@ -2100,7 +2091,14 @@ GMT_destroy (struct MeshTunnel3 *t) GMP_set_tunnel (t->peer, NULL); if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) + { GNUNET_SCHEDULER_cancel (t->rekey_task); + t->rekey_task = GNUNET_SCHEDULER_NO_TASK; + if (NULL != t->kx_ctx) + GNUNET_free (t->kx_ctx); + else + GNUNET_break (0); + } GNUNET_free (t); } -- 2.25.1