aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/test_testbed_api_controllerlink.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-02-12 10:05:40 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-02-12 10:05:40 +0000
commitffec951065ab72b166947788acc6cc6694c443cc (patch)
treecfb5b015a0bbe96b66a5980f354b8d746762fd81 /src/testbed/test_testbed_api_controllerlink.c
parent9174ab063cf1a5a33e8035073b88b785e0151f4d (diff)
- fix crashing tests
Diffstat (limited to 'src/testbed/test_testbed_api_controllerlink.c')
-rw-r--r--src/testbed/test_testbed_api_controllerlink.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/testbed/test_testbed_api_controllerlink.c b/src/testbed/test_testbed_api_controllerlink.c
index eadc6c9ff2..1d0a3652ce 100644
--- a/src/testbed/test_testbed_api_controllerlink.c
+++ b/src/testbed/test_testbed_api_controllerlink.c
@@ -252,6 +252,11 @@ static struct GNUNET_TESTBED_Peer *master_peer;
struct GNUNET_TESTBED_HostHabitableCheckHandle *hc_handle;
/**
+ * The task handle for the delay task
+ */
+GNUNET_SCHEDULER_TaskIdentifier delay_task_id;
+
+/**
* Event mask
*/
uint64_t event_mask;
@@ -273,6 +278,11 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
if (GNUNET_SCHEDULER_NO_TASK != abort_task)
GNUNET_SCHEDULER_cancel (abort_task);
+ if (GNUNET_SCHEDULER_NO_TASK != delay_task_id)
+ {
+ GNUNET_SCHEDULER_cancel (delay_task_id);
+ delay_task_id = GNUNET_SCHEDULER_NO_TASK;
+ }
if (NULL != hc_handle)
GNUNET_TESTBED_is_host_habitable_cancel (hc_handle);
if (NULL != slave3)
@@ -335,6 +345,7 @@ do_abort_now (void *cls)
static void
delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
+ delay_task_id = GNUNET_SCHEDULER_NO_TASK;
switch (result)
{
case SLAVE2_PEER_CREATE_SUCCESS:
@@ -383,9 +394,11 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
result = SLAVE2_PEER_CREATE_SUCCESS;
slave2_peer = peer;
GNUNET_TESTBED_operation_done (op);
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 1), &delay_task,
- NULL);
+ delay_task_id =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 1),
+ &delay_task,
+ NULL);
break;
default:
GNUNET_assert (0);
@@ -496,9 +509,10 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
result = MASTER_SLAVE2_PEERS_CONNECTED;
GNUNET_TESTBED_operation_done (op);
op = NULL;
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 1), &delay_task,
- NULL);
+ delay_task_id =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 1), &delay_task,
+ NULL);
break;
case MASTER_SLAVE2_PEERS_CONNECTED:
GNUNET_assert (GNUNET_TESTBED_ET_PEER_STOP == event->type);