From e58b22c326781e754672759bd5885f32b64d0626 Mon Sep 17 00:00:00 2001 From: Sree Harsha Totakura Date: Mon, 15 Apr 2013 14:10:35 +0000 Subject: [PATCH] - fixes --- src/testbed/gnunet-service-testbed_links.c | 12 +++++++----- src/testbed/gnunet-testbed-profiler.c | 6 ++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/testbed/gnunet-service-testbed_links.c b/src/testbed/gnunet-service-testbed_links.c index 80e96762b..0c89392de 100644 --- a/src/testbed/gnunet-service-testbed_links.c +++ b/src/testbed/gnunet-service-testbed_links.c @@ -762,24 +762,24 @@ trigger_notifications (struct Neighbour *n) 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); } @@ -859,6 +859,8 @@ GST_neighbour_get_connection_cancel (struct NeighbourConnectNotification *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) diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index 1bcce20e4..24b3cdac6 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c @@ -110,9 +110,15 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { 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 */ } -- 2.25.1