From: Matthias Wachs Date: Mon, 2 Jul 2012 07:52:35 +0000 (+0000) Subject: fix for mantis 2445 & 2471 X-Git-Tag: initial-import-from-subversion-38251~12708 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a8ac22b369ad152cc2422b738997768cc1761fc9;p=oweals%2Fgnunet.git fix for mantis 2445 & 2471 --- diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 23c8bdb35..d2cf8d6aa 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -870,7 +870,7 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions) { struct MessageQueue *mq; struct GNUNET_TRANSPORT_PluginFunctions *papi; - //struct GNUNET_HELLO_Address *old_address; + struct GNUNET_HELLO_Address *backup_primary; n->is_active = NULL; /* always free'd by its own continuation! */ @@ -893,11 +893,16 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions) disconnect_notify_cb (callback_cls, &n->id); } + n->state = S_DISCONNECT_FINISHED; - /* cut transport-level connection */ - //old_address = GNUNET_HELLO_address_copy(n->primary_address.address); - + if (NULL != n->primary_address.address) + backup_primary = GNUNET_HELLO_address_copy(n->primary_address.address); + else + backup_primary = NULL; + /* free addresses and mark as unused */ + free_address (&n->primary_address); + free_address (&n->alternative_address); /* FIXME-PLUGIN-API: This does not seem to guarantee that all transport sessions eventually get killed due to inactivity; they @@ -909,16 +914,13 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions) them! Killing all sessions like this seems to be very, very wrong. */ + /* cut transport-level connection */ if ((GNUNET_NO == keep_sessions) && - (NULL != n->primary_address.address) && - (NULL != (papi = GST_plugins_find (n->primary_address.address->transport_name)))) + (NULL != backup_primary) && + (NULL != (papi = GST_plugins_find (backup_primary->transport_name)))) papi->disconnect (papi->cls, &n->id); - - n->state = S_DISCONNECT_FINISHED; - - free_address (&n->primary_address); - free_address (&n->alternative_address); + GNUNET_free_non_null (backup_primary); GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (neighbours,