aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-testbed-profiler.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-10-12 16:14:29 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-10-12 16:14:29 +0000
commit55dc3775de2049df85ce51f722c5b002094524b2 (patch)
treed7b9f2459ea90b8020afb865c8d331454196b232 /src/testbed/gnunet-testbed-profiler.c
parentd2cc065ef24dffcb7f09b471accef303935b4237 (diff)
downloadgnunet-55dc3775de2049df85ce51f722c5b002094524b2.tar.gz
gnunet-55dc3775de2049df85ce51f722c5b002094524b2.zip
fixes
Diffstat (limited to 'src/testbed/gnunet-testbed-profiler.c')
-rw-r--r--src/testbed/gnunet-testbed-profiler.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c
index 7e85f3ca2..6bfc15728 100644
--- a/src/testbed/gnunet-testbed-profiler.c
+++ b/src/testbed/gnunet-testbed-profiler.c
@@ -188,8 +188,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
188 if (NULL != hosts[nhost]) 188 if (NULL != hosts[nhost])
189 GNUNET_TESTBED_host_destroy (hosts[nhost]); 189 GNUNET_TESTBED_host_destroy (hosts[nhost]);
190 GNUNET_free_non_null (hosts); 190 GNUNET_free_non_null (hosts);
191 dll_op = dll_op_head; 191 while (NULL != (dll_op = dll_op_head))
192 while (NULL != dll_op)
193 { 192 {
194 GNUNET_TESTBED_operation_cancel (dll_op->op); 193 GNUNET_TESTBED_operation_cancel (dll_op->op);
195 GNUNET_free_non_null (dll_op->cls); 194 GNUNET_free_non_null (dll_op->cls);
@@ -233,6 +232,8 @@ controller_event_cb (void *cls,
233 const struct GNUNET_TESTBED_EventInformation *event) 232 const struct GNUNET_TESTBED_EventInformation *event)
234{ 233{
235 struct DLLOperation *dll_op; 234 struct DLLOperation *dll_op;
235 struct GNUNET_TESTBED_Operation *op;
236
236 switch (state) 237 switch (state)
237 { 238 {
238 case STATE_SLAVES_STARTING: 239 case STATE_SLAVES_STARTING:
@@ -244,19 +245,21 @@ controller_event_cb (void *cls,
244 245
245 dll_op = event->details.operation_finished.op_cls; 246 dll_op = event->details.operation_finished.op_cls;
246 GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op); 247 GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op);
248 GNUNET_free (dll_op);
249 op = event->details.operation_finished.operation;
247 if (NULL != event->details.operation_finished.emsg) 250 if (NULL != event->details.operation_finished.emsg)
248 { 251 {
249 LOG (GNUNET_ERROR_TYPE_WARNING, 252 LOG (GNUNET_ERROR_TYPE_WARNING,
250 _("An operation has failed while starting slaves\n")); 253 _("An operation has failed while starting slaves\n"));
254 GNUNET_TESTBED_operation_done (op);
251 GNUNET_SCHEDULER_cancel (abort_task); 255 GNUNET_SCHEDULER_cancel (abort_task);
252 abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); 256 abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
253 return; 257 return;
254 } 258 }
255 GNUNET_TESTBED_operation_done (dll_op->op); 259 GNUNET_TESTBED_operation_done (op);
256 GNUNET_free (dll_op);
257 /* Proceed to start peers */ 260 /* Proceed to start peers */
258 if (++slaves_started == num_hosts - 1) 261 if (++slaves_started == num_hosts - 1)
259 printf ("All slaves started successfully"); 262 printf ("All slaves started successfully\n");
260 } 263 }
261 break; 264 break;
262 default: 265 default:
@@ -320,13 +323,14 @@ register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
320 LOG (GNUNET_ERROR_TYPE_DEBUG, 323 LOG (GNUNET_ERROR_TYPE_DEBUG,
321 "All hosts successfully registered\n"); 324 "All hosts successfully registered\n");
322 /* Start slaves */ 325 /* Start slaves */
326 state = STATE_SLAVES_STARTING;
323 for (slave = 1; slave < num_hosts; slave++) 327 for (slave = 1; slave < num_hosts; slave++)
324 { 328 {
325 dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); 329 dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
326 dll_op->op = GNUNET_TESTBED_controller_link (dll_op, 330 dll_op->op = GNUNET_TESTBED_controller_link (dll_op,
327 mc, 331 mc,
328 hosts[slave], 332 hosts[slave],
329 NULL, 333 hosts[0],
330 cfg, 334 cfg,
331 GNUNET_YES); 335 GNUNET_YES);
332 GNUNET_CONTAINER_DLL_insert_tail (dll_op_head, dll_op_tail, dll_op); 336 GNUNET_CONTAINER_DLL_insert_tail (dll_op_head, dll_op_tail, dll_op);
@@ -363,6 +367,7 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, int stat
363 event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_STOP); 367 event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_STOP);
364 event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); 368 event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
365 event_mask |= (1LL << GNUNET_TESTBED_ET_DISCONNECT); 369 event_mask |= (1LL << GNUNET_TESTBED_ET_DISCONNECT);
370 event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
366 mc = GNUNET_TESTBED_controller_connect (config, hosts[0], event_mask, 371 mc = GNUNET_TESTBED_controller_connect (config, hosts[0], event_mask,
367 &controller_event_cb, NULL); 372 &controller_event_cb, NULL);
368 if (NULL == mc) 373 if (NULL == mc)