/*
This file is part of GNUnet
- (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
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
SLAVE3_LINK_SUCCESS,
/**
- * Destory master peer and mark test as success
+ * Master peer destoryed. Destory slave 3 peer
+ */
+ MASTER_PEER_DESTROY_SUCCESS,
+
+ /**
+ * Slave 3 peer destroyed. Mark test as success
*/
SUCCESS,
/**
* Abort task
*/
-static GNUNET_SCHEDULER_TaskIdentifier abort_task;
+static struct GNUNET_SCHEDULER_Task * abort_task;
/**
* Operation handle for linking controllers
/**
* The task handle for the delay task
*/
-GNUNET_SCHEDULER_TaskIdentifier delay_task_id;
+struct GNUNET_SCHEDULER_Task * delay_task_id;
/**
* Event mask
#define FAIL_TEST(cond) do { \
if (!(cond)) { \
GNUNET_break(0); \
- if (GNUNET_SCHEDULER_NO_TASK != abort_task) \
+ if (NULL != abort_task) \
GNUNET_SCHEDULER_cancel (abort_task); \
- abort_task = GNUNET_SCHEDULER_NO_TASK; \
- GNUNET_SCHEDULER_add_now (do_shutdown, NULL); \
+ abort_task = NULL; \
+ GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); \
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 (GNUNET_SCHEDULER_NO_TASK != abort_task)
+ if (NULL != abort_task)
GNUNET_SCHEDULER_cancel (abort_task);
- if (GNUNET_SCHEDULER_NO_TASK != delay_task_id)
+ if (NULL != delay_task_id)
{
GNUNET_SCHEDULER_cancel (delay_task_id);
- delay_task_id = GNUNET_SCHEDULER_NO_TASK;
+ delay_task_id = NULL;
}
if (NULL != hc_handle)
GNUNET_TESTBED_is_host_habitable_cancel (hc_handle);
* 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");
- abort_task = GNUNET_SCHEDULER_NO_TASK;
- do_shutdown (cls, tc);
+ abort_task = NULL;
+ do_shutdown (cls);
}
static void
do_abort_now (void *cls)
{
- if (GNUNET_SCHEDULER_NO_TASK != abort_task)
+ if (NULL != abort_task)
GNUNET_SCHEDULER_cancel (abort_task);
abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
}
* @return
*/
static void
-delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+delay_task (void *cls)
{
- delay_task_id = GNUNET_SCHEDULER_NO_TASK;
+ delay_task_id = NULL;
switch (result)
{
case SLAVE2_PEER_CREATE_SUCCESS:
break;
case SLAVE3_LINK_SUCCESS:
check_operation_success (event);
+ result = MASTER_PEER_DESTROY_SUCCESS;
+ GNUNET_TESTBED_operation_done (op);
+ op = GNUNET_TESTBED_peer_destroy (slave3_peer);
+ break;
+ case MASTER_PEER_DESTROY_SUCCESS:
result = SUCCESS;
GNUNET_TESTBED_operation_done (op);
op = NULL;
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 1), &do_shutdown,
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+ &do_shutdown,
NULL);
break;
default:
"to use password less SSH logins to localhost.\n"
"Skipping test\n");
GNUNET_SCHEDULER_cancel (abort_task);
- abort_task = GNUNET_SCHEDULER_NO_TASK;
+ abort_task = NULL;
(void) GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
result = SKIP;
return;