- fixes
authorSree Harsha Totakura <totakura@in.tum.de>
Mon, 15 Apr 2013 14:10:35 +0000 (14:10 +0000)
committerSree Harsha Totakura <totakura@in.tum.de>
Mon, 15 Apr 2013 14:10:35 +0000 (14:10 +0000)
src/testbed/gnunet-service-testbed_links.c
src/testbed/gnunet-testbed-profiler.c

index 80e96762bf7a54751345558ade88ec694f76b0d6..0c89392de7d75ae3949f5e1524a36b276cc60c8e 100644 (file)
@@ -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)
index 1bcce20e479b47e67e033102ff3abedce385e9a5..24b3cdac6c2d3c0e47dab42644f007ce6910a8d9 100644 (file)
@@ -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 */
 }