aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/test_testbed_api.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-07-09 11:38:23 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-07-09 11:38:23 +0000
commit503639790dcf7951a7ac6da5f8d0e248844bd96e (patch)
treeb38faa72b6fd63b3cda57744bcb4079d0208d820 /src/testbed/test_testbed_api.c
parentfbb36b18c6d58e14a8fe1af922a72bb58fb6a4f7 (diff)
downloadgnunet-503639790dcf7951a7ac6da5f8d0e248844bd96e.tar.gz
gnunet-503639790dcf7951a7ac6da5f8d0e248844bd96e.zip
-inlined peer destroy in testcase
Diffstat (limited to 'src/testbed/test_testbed_api.c')
-rw-r--r--src/testbed/test_testbed_api.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c
index 2ed3e1fa8..b1b9fb280 100644
--- a/src/testbed/test_testbed_api.c
+++ b/src/testbed/test_testbed_api.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file testbed/test_testbed_api.c 22 * @file testbed/test_testbed_api.c
23 * @brief testcases for the testbed api 23 * @brief testcases for the testbed api
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
@@ -83,11 +83,6 @@ static struct GNUNET_TESTBED_Operation *operation;
83static GNUNET_SCHEDULER_TaskIdentifier abort_task; 83static GNUNET_SCHEDULER_TaskIdentifier abort_task;
84 84
85/** 85/**
86 * Peer destroy task identifier
87 */
88static GNUNET_SCHEDULER_TaskIdentifier peer_destroy_task;
89
90/**
91 * The testing result 86 * The testing result
92 */ 87 */
93static int result; 88static int result;
@@ -123,8 +118,6 @@ do_abort (void *cls, const const struct GNUNET_SCHEDULER_TaskContext *tc)
123{ 118{
124 LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); 119 LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
125 abort_task = GNUNET_SCHEDULER_NO_TASK; 120 abort_task = GNUNET_SCHEDULER_NO_TASK;
126 if (GNUNET_SCHEDULER_NO_TASK != peer_destroy_task)
127 GNUNET_SCHEDULER_cancel (peer_destroy_task);
128 do_shutdown (cls, tc); 121 do_shutdown (cls, tc);
129} 122}
130 123
@@ -152,22 +145,6 @@ controller_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
152 145
153 146
154/** 147/**
155 * Task for destroying the peer
156 *
157 * @param cls NULL
158 * @param tc the task context
159 */
160static void
161do_peer_destroy (void *cls,
162 const const struct GNUNET_SCHEDULER_TaskContext *tc)
163{
164 peer_destroy_task = GNUNET_SCHEDULER_NO_TASK;
165 operation = GNUNET_TESTBED_peer_destroy (peer);
166 GNUNET_assert (NULL != operation);
167}
168
169
170/**
171 * Callback which will be called to after a host registration succeeded or failed 148 * Callback which will be called to after a host registration succeeded or failed
172 * 149 *
173 * @param cls the host which has been registered 150 * @param cls the host which has been registered
@@ -180,8 +157,8 @@ registration_comp (void *cls, const char *emsg)
180 reg_handle = NULL; 157 reg_handle = NULL;
181 peer = GNUNET_TESTBED_peer_create (controller, host, cfg); 158 peer = GNUNET_TESTBED_peer_create (controller, host, cfg);
182 GNUNET_assert (NULL != peer); 159 GNUNET_assert (NULL != peer);
183 peer_destroy_task = 160 operation = GNUNET_TESTBED_peer_destroy (peer);
184 GNUNET_SCHEDULER_add_now (&do_peer_destroy, NULL); 161 GNUNET_assert (NULL != operation);
185} 162}
186 163
187 164