/*
This file is part of GNUnet
- Copyright (C) 2008--2013 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2008--2013 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
/**
* Abort task
*/
-static struct GNUNET_SCHEDULER_Task * abort_task;
+static struct GNUNET_SCHEDULER_Task *abort_task;
/**
* Operation handle for linking controllers
/**
* The handle for whether a host is habitable or not
*/
-struct GNUNET_TESTBED_HostHabitableCheckHandle *hc_handle;
+static struct GNUNET_TESTBED_HostHabitableCheckHandle *hc_handle;
/**
* The task handle for the delay task
*/
-struct GNUNET_SCHEDULER_Task * delay_task_id;
+static struct GNUNET_SCHEDULER_Task *delay_task_id;
/**
* Event mask
*/
-uint64_t event_mask;
+static uint64_t event_mask;
/**
* Global testing status
if (NULL != abort_task) \
GNUNET_SCHEDULER_cancel (abort_task); \
abort_task = NULL; \
- GNUNET_SCHEDULER_add_now (do_shutdown, NULL); \
+ GNUNET_SCHEDULER_shutdown (); \
return; \
} \
} while (0)
* Shutdown nicely
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != abort_task)
GNUNET_SCHEDULER_cancel (abort_task);
}
if (NULL != hc_handle)
GNUNET_TESTBED_is_host_habitable_cancel (hc_handle);
+ if (NULL != op)
+ {
+ GNUNET_TESTBED_operation_done (op);
+ op = NULL;
+ }
if (NULL != mc)
GNUNET_TESTBED_controller_disconnect (mc);
if (NULL != cp)
* abort task to run on test timed out
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
- LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting\n");
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "Aborting in stage %d\n",
+ result);
abort_task = NULL;
- do_shutdown (cls, tc);
+ GNUNET_SCHEDULER_shutdown ();
}
* @return
*/
static void
-delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+delay_task (void *cls)
{
delay_task_id = NULL;
switch (result)
* @param emsg NULL if peer is not NULL; else MAY contain the error description
*/
static void
-peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
+peer_create_cb (void *cls,
+ struct GNUNET_TESTBED_Peer *peer,
+ const char *emsg)
{
FAIL_TEST (NULL != peer);
FAIL_TEST (NULL == emsg);
result = SLAVE2_PEER_CREATE_SUCCESS;
slave2_peer = peer;
GNUNET_TESTBED_operation_done (op);
+ op = NULL;
delay_task_id =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 1),
&delay_task,
NULL);
- break;
+ return;
case SLAVE3_STARTED:
result = SLAVE3_PEER_CREATE_SUCCESS;
slave3_peer = peer;
* @param event information about the event
*/
static void
-controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
+controller_cb (void *cls,
+ const struct GNUNET_TESTBED_EventInformation *event)
{
switch (result)
{
FAIL_TEST (event->details.peer_start.host == host);
FAIL_TEST (event->details.peer_start.peer == master_peer);
GNUNET_TESTBED_operation_done (op);
+ op = NULL;
result = MASTER_PEER_START_SUCCESS;
slave = GNUNET_TESTBED_host_create_with_id (1, "127.0.0.1", NULL, cfg, 0);
FAIL_TEST (NULL != slave);
case SLAVE3_REGISTERED:
check_operation_success (event);
GNUNET_TESTBED_operation_done (op);
- op = NULL;
result = SLAVE3_STARTED;
op = GNUNET_TESTBED_peer_create (mc, slave3, cfg, peer_create_cb, NULL);
FAIL_TEST (NULL != op);
result = SUCCESS;
GNUNET_TESTBED_operation_done (op);
op = NULL;
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 1), &do_shutdown,
- NULL);
+ GNUNET_SCHEDULER_shutdown ();
break;
default:
FAIL_TEST (0);
* @param cls NULL
* @param host the host whose status is being reported; will be NULL if the host
* given to GNUNET_TESTBED_is_host_habitable() is NULL
- * @param status GNUNET_YES if it is habitable; GNUNET_NO if not
+ * @param status #GNUNET_YES if it is habitable; #GNUNET_NO if not
*/
static void
-host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *_host,
+host_habitable_cb (void *cls,
+ const struct GNUNET_TESTBED_Host *_host,
int status)
{
hc_handle = NULL;
"Skipping test\n");
GNUNET_SCHEDULER_cancel (abort_task);
abort_task = NULL;
- (void) GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
+ GNUNET_SCHEDULER_shutdown ();
result = SKIP;
return;
}
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MINUTES, 5), &do_abort,
NULL);
+ GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
+ NULL);
}