From da070a9e53e0f4f8b8f1225755fbf5d74635262d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 25 Mar 2010 13:42:56 +0000 Subject: [PATCH] trying to fix bug --- src/transport/transport_api.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 07c6948ac..bfbaa2250 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c @@ -356,6 +356,12 @@ struct GNUNET_TRANSPORT_Handle * Delay until we try to reconnect. */ struct GNUNET_TIME_Relative reconnect_delay; + + /** + * Set once we are in the process of disconnecting from the + * service. + */ + int in_disconnect; }; @@ -1215,6 +1221,8 @@ schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h) /** * Add neighbour to our list + * + * @return NULL if this API is currently disconnecting from the service */ static struct NeighbourList * neighbour_add (struct GNUNET_TRANSPORT_Handle *h, @@ -1222,6 +1230,8 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h, { struct NeighbourList *n; + if (GNUNET_YES == h->in_disconnect) + return NULL; /* check for duplicates */ if (NULL != (n = neighbour_find (h, pid))) { @@ -1295,6 +1305,7 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) #if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transport disconnect called!\n"); #endif + handle->in_disconnect = GNUNET_YES; while (NULL != (n = handle->neighbours)) { handle->neighbours = n->next; @@ -1478,6 +1489,8 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) if (n == NULL) n = neighbour_add (h, &cim->id); + if (n == NULL) + return; GNUNET_break (n->is_connected == GNUNET_NO); n->is_connected = GNUNET_YES; if (h->nc_cb != NULL) -- 2.25.1