From 6f4e34b7a3cb7263d6e8839fa1ba75e9f5a9162e Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Thu, 19 Jan 2012 11:06:37 +0000 Subject: [PATCH] Fixed an assert error when a client disconnects with open tunnels and without doing MESH_disconnect --- src/mesh/gnunet-service-mesh.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 08f722611..d871ee12d 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c @@ -411,6 +411,12 @@ struct MeshClient */ struct GNUNET_CONTAINER_MultiHashMap *types; + /** + * Whether the client is active or shutting down (don't send confirmations + * to a client that is shutting down. + */ + int shutting_down; + #if MESH_DEBUG /** * ID of the client, for debug messages @@ -912,7 +918,7 @@ send_clients_tunnel_destroy (struct MeshTunnel *t) * notification. Otherwise, the origin gets a (local ID) peer disconnected. * * @param t Tunnel that was destroyed. - * @param c Client that disconnected + * @param c Client that disconnected. */ static void send_client_tunnel_disconnect (struct MeshTunnel *t, struct MeshClient *c) @@ -2123,7 +2129,7 @@ tunnel_send_multicast (struct MeshTunnel *t, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: not a data packet, no ttl\n"); #endif } - if (NULL != t->client) + if (NULL != t->client && GNUNET_YES != t->client->shutting_down) { mdata->task = GNUNET_malloc (sizeof (GNUNET_SCHEDULER_TaskIdentifier)); (*(mdata->task)) = @@ -3467,6 +3473,7 @@ handle_local_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) c->id); #endif GNUNET_SERVER_client_drop (c->handle); + c->shutting_down = GNUNET_YES; if (NULL != c->tunnels) { GNUNET_CONTAINER_multihashmap_iterate (c->tunnels, -- 2.25.1