X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Ftestbed%2Ftest_testbed_api_3peers_3controllers.c;h=4e67ef152cf7c86ba361b9efe371794528232d27;hb=7a5a724a6f96baf80d2226326124aa01c58ad3fe;hp=48e60f108326991406be7d156bda173a4bc11432;hpb=f4446e40904ba3f3177a8eaf1f9756e48dcc03a9;p=oweals%2Fgnunet.git diff --git a/src/testbed/test_testbed_api_3peers_3controllers.c b/src/testbed/test_testbed_api_3peers_3controllers.c index 48e60f108..4e67ef152 100644 --- a/src/testbed/test_testbed_api_3peers_3controllers.c +++ b/src/testbed/test_testbed_api_3peers_3controllers.c @@ -1,21 +1,19 @@ /* 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 - by the Free Software Foundation; either version 3, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - 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. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . */ /** @@ -151,12 +149,12 @@ struct GNUNET_TESTBED_HostHabitableCheckHandle *hc_handle; /** * Abort task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * Delayed connect job identifier */ -static GNUNET_SCHEDULER_TaskIdentifier delayed_connect_task; +static struct GNUNET_SCHEDULER_Task * delayed_connect_task; /** * Different stages in testing @@ -254,16 +252,15 @@ static enum Stage result; * 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 (NULL != hc_handle) GNUNET_TESTBED_is_host_habitable_cancel (hc_handle); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == delayed_connect_task); + GNUNET_assert (NULL == delayed_connect_task); if (NULL != common_operation) GNUNET_TESTBED_operation_done (common_operation); if (NULL != reg_handle) @@ -288,25 +285,25 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * 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, "Test timedout -- Aborting\n"); - abort_task = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != delayed_connect_task) + abort_task = NULL; + if (NULL != delayed_connect_task) { GNUNET_SCHEDULER_cancel (delayed_connect_task); - delayed_connect_task = GNUNET_SCHEDULER_NO_TASK; + delayed_connect_task = NULL; } - do_shutdown (cls, tc); + do_shutdown (cls); } + static void abort_test () { - 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); } @@ -328,12 +325,11 @@ op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg); * task for delaying a connect * * @param cls NULL - * @param tc the task context */ static void -do_delayed_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_delayed_connect (void *cls) { - delayed_connect_task = GNUNET_SCHEDULER_NO_TASK; + delayed_connect_task = NULL; if (NULL != common_operation) { GNUNET_break (0); @@ -566,7 +562,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) result = PEER1_STARTED; common_operation = GNUNET_TESTBED_controller_link (NULL, controller1, neighbour1, NULL, - cfg, GNUNET_YES); + GNUNET_YES); break; case PEER2_CREATED: if (event->details.peer_start.host != neighbour1) @@ -587,7 +583,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) } common_operation = GNUNET_TESTBED_controller_link (NULL, controller1, neighbour2, NULL, - cfg, GNUNET_YES); + GNUNET_YES); if (NULL == common_operation) { GNUNET_break (0); @@ -845,10 +841,11 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, * @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; @@ -859,13 +856,13 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *_host, "to use password less SSH logins to localhost.\n" "Skipping test\n"); GNUNET_SCHEDULER_cancel (abort_task); - abort_task = GNUNET_SCHEDULER_NO_TASK; - (void) GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); + abort_task = NULL; + GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); result = SKIP; return; } cp1 = - GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb, NULL); + GNUNET_TESTBED_controller_start ("127.0.0.1", host, status_cb, NULL); }