From a8001b19370e6b7cd270d0286b7d99f1893dba34 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Fri, 30 Aug 2013 03:53:34 +0000 Subject: [PATCH] - remove channels from client hashmap on disconnect --- src/mesh/gnunet-service-mesh-enc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mesh/gnunet-service-mesh-enc.c b/src/mesh/gnunet-service-mesh-enc.c index 660446be0..64d128ee2 100644 --- a/src/mesh/gnunet-service-mesh-enc.c +++ b/src/mesh/gnunet-service-mesh-enc.c @@ -1840,6 +1840,7 @@ send_prebuilt_message_connection (const struct GNUNET_MessageHeader *message, struct GNUNET_MESH_Encrypted *emsg; struct GNUNET_MESH_ACK *amsg; struct GNUNET_MESH_Poll *pmsg; + struct GNUNET_MESH_ConnectionDestroy *dmsg; uint32_t ttl; case GNUNET_MESSAGE_TYPE_MESH_FWD: @@ -1870,6 +1871,12 @@ send_prebuilt_message_connection (const struct GNUNET_MessageHeader *message, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " poll %u\n", ntohl (pmsg->pid)); break; + case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY: + dmsg = (struct GNUNET_MESH_ConnectionDestroy *) data; + dmsg->cid = c->id; + dmsg->reserved = 0; + break; + default: GNUNET_break (0); } @@ -4156,7 +4163,7 @@ channel_send_destroy (struct MeshChannel *ch) if (channel_is_terminal (ch, GNUNET_NO)) { - if (NULL != ch->root) + if (NULL != ch->root && GNUNET_NO == ch->root->shutting_down) { msg.chid = htonl (ch->lid_root); send_local_channel_destroy (ch, GNUNET_NO); @@ -4170,7 +4177,7 @@ channel_send_destroy (struct MeshChannel *ch) if (channel_is_terminal (ch, GNUNET_YES)) { - if (NULL != ch->dest) + if (NULL != ch->dest && GNUNET_NO == ch->dest->shutting_down) { msg.chid = htonl (ch->lid_dest); send_local_channel_destroy (ch, GNUNET_YES); @@ -4520,12 +4527,10 @@ channel_destroy_iterator (void *cls, if (c == ch->dest) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Client %u is destination.\n", c->id); - ch->dest = NULL; } if (c == ch->root) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Client %u is owner.\n", c->id); - ch->root = NULL; } t = ch->t; -- 2.25.1