X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Ftransport%2Fgnunet-service-transport_neighbours.c;h=47e2713870609e97b384ba20ac990aae32df1f7f;hb=dc994999f6702effb64e5bfc3eb727ee0f3723ef;hp=1c7cc9f59df09e4907966bb6586fc68248d0779a;hpb=047de959d99fea44ded0a93089d71930f3f5258e;p=oweals%2Fgnunet.git diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 1c7cc9f59..47e271387 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -847,10 +847,11 @@ set_address (struct NeighbourAddress *na, * Free a neighbour map entry. * * @param n entry to free - * @param terminate tell plugin to terminate sessions + * @param keep_sessions GNUNET_NO to tell plugin to terminate sessions, + * GNUNET_YES to keep all sessions */ static void -free_neighbour (struct NeighbourMapEntry *n, int terminate) +free_neighbour (struct NeighbourMapEntry *n, int keep_sessions) { struct MessageQueue *mq; struct GNUNET_TRANSPORT_PluginFunctions *papi; @@ -885,7 +886,7 @@ free_neighbour (struct NeighbourMapEntry *n, int terminate) API gives us not even the means to selectively kill only one of them! Killing all sessions like this seems to be very, very wrong. */ - if ((GNUNET_YES == terminate) && + if ((GNUNET_NO == keep_sessions) && (NULL != n->primary_address.address) && (NULL != (papi = GST_plugins_find (n->primary_address.address->transport_name)))) papi->disconnect (papi->cls, &n->id); @@ -985,7 +986,8 @@ send_disconnect_cont (void *cls, const struct GNUNET_PeerIdentity *target, if (S_DISCONNECT != n->state) return; /* have created a fresh entry since */ n->state = S_DISCONNECT; - GNUNET_SCHEDULER_cancel (n->task); + if (GNUNET_SCHEDULER_NO_TASK != n->task) + GNUNET_SCHEDULER_cancel (n->task); n->task = GNUNET_SCHEDULER_add_now (&master_task, n); } @@ -1132,7 +1134,8 @@ transmit_send_continuation (void *cls, /* this is still "our" neighbour, remove us from its queue and allow it to send the next message now */ n->is_active = NULL; - GNUNET_SCHEDULER_cancel (n->task); + if (GNUNET_SCHEDULER_NO_TASK != n->task) + GNUNET_SCHEDULER_cancel (n->task); n->task = GNUNET_SCHEDULER_add_now (&master_task, n); } GNUNET_assert (bytes_in_send_queue >= mq->message_buf_size); @@ -1486,7 +1489,8 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, const void *msg, if ( (NULL != n->is_active) || ( (NULL == n->primary_address.session) && (NULL == n->primary_address.address)) ) return; - GNUNET_SCHEDULER_cancel (n->task); + if (GNUNET_SCHEDULER_NO_TASK != n->task) + GNUNET_SCHEDULER_cancel (n->task); n->task = GNUNET_SCHEDULER_add_now (&master_task, n); } @@ -2452,10 +2456,10 @@ master_task (void *cls, } delay = GNUNET_TIME_relative_min (GNUNET_TIME_absolute_get_remaining (n->keep_alive_time), delay); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == n->task); - n->task = GNUNET_SCHEDULER_add_delayed (delay, - &master_task, - n); + if (GNUNET_SCHEDULER_NO_TASK == n->task) + n->task = GNUNET_SCHEDULER_add_delayed (delay, + &master_task, + n); }