GNUNET_TESTBED_operation_activate_ (n->conn_op);
n->inactive = 0;
}
+ n->reference_cnt++;
n->notify_task =
- GNUNET_SCHEDULER_add_now (&neighbour_connect_notify_task, n->nl_head);
+ GNUNET_SCHEDULER_add_now (&neighbour_connect_notify_task, n);
}
static void
neighbour_connect_notify_task (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct NeighbourConnectNotification *h = cls;
- struct Neighbour *n;
+ struct Neighbour *n = cls;
+ struct NeighbourConnectNotification *h;
- n = h->n;
+ GNUNET_assert (NULL != (h = n->nl_head));
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != n->notify_task);
n->notify_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_assert (NULL != n->controller);
GNUNET_CONTAINER_DLL_remove (n->nl_head, n->nl_tail, h);
trigger_notifications (n);
- n->reference_cnt++;
h->cb (h->cb_cls, n->controller);
GNUNET_free (h);
}
return;
if (GNUNET_SCHEDULER_NO_TASK == n->notify_task)
return;
+ GNUNET_assert (0 < n->reference_cnt);
+ n->reference_cnt--;
GNUNET_SCHEDULER_cancel (n->notify_task);
n->notify_task = GNUNET_SCHEDULER_NO_TASK;
if (NULL == n->nl_head)
{
shutdown_task = GNUNET_SCHEDULER_NO_TASK;
if (GNUNET_SCHEDULER_NO_TASK != abort_task)
+ {
GNUNET_SCHEDULER_cancel (abort_task);
+ abort_task = GNUNET_SCHEDULER_NO_TASK;
+ }
if (NULL != cfg)
+ {
GNUNET_CONFIGURATION_destroy (cfg);
+ cfg = NULL;
+ }
GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */
}