* 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;
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);
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);
}
/* 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);
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);
}
/* ATS asks us to switch a life connection; see if we can get
a CONNECT_ACK on it before we actually do this! */
set_address (&n->alternative_address,
- address, session, bandwidth_in, bandwidth_out, GNUNET_YES);
+ address, session, bandwidth_in, bandwidth_out, GNUNET_NO);
n->state = S_CONNECTED_SWITCHING_BLACKLIST;
check_blacklist (&n->id,
GNUNET_TIME_absolute_get (),
}
/* ATS asks us to switch a life connection, update blacklist check */
set_address (&n->alternative_address,
- address, session, bandwidth_in, bandwidth_out, GNUNET_YES);
+ address, session, bandwidth_in, bandwidth_out, GNUNET_NO);
check_blacklist (&n->id,
GNUNET_TIME_absolute_get (),
address, session, ats, ats_count);
}
/* ATS asks us to switch a life connection, update blacklist check */
set_address (&n->alternative_address,
- address, session, bandwidth_in, bandwidth_out, GNUNET_YES);
+ address, session, bandwidth_in, bandwidth_out, GNUNET_NO);
n->state = S_CONNECTED_SWITCHING_BLACKLIST;
check_blacklist (&n->id,
GNUNET_TIME_absolute_get (),
}
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);
}
/* new address worked; adopt it and go back to connected! */
n->state = S_CONNECTED;
n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
- GNUNET_assert (GNUNET_NO == n->alternative_address.ats_active);
+ GNUNET_break (GNUNET_NO == n->alternative_address.ats_active);
set_address (&n->primary_address,
n->alternative_address.address,
n->alternative_address.session,