aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-10-14 10:49:34 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-10-14 10:49:34 +0000
commit507330be531ebac9350bdf70370ff57ddfd2f054 (patch)
treed8971205a0183bdb159f6e0c7b720f5096ff5a0f /src/testbed
parentcc0f8581409bde67d45fdf9803cb375cdf46b727 (diff)
downloadgnunet-507330be531ebac9350bdf70370ff57ddfd2f054.tar.gz
gnunet-507330be531ebac9350bdf70370ff57ddfd2f054.zip
towards peer create
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-testbed-profiler.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c
index 64f418569..0bf252d2e 100644
--- a/src/testbed/gnunet-testbed-profiler.c
+++ b/src/testbed/gnunet-testbed-profiler.c
@@ -80,7 +80,12 @@ enum State
80 /** 80 /**
81 * Creating peers 81 * Creating peers
82 */ 82 */
83 STATE_PEERS_CREATING 83 STATE_PEERS_CREATING,
84
85 /**
86 * Starting peers
87 */
88 STATE_PEERS_STARTING
84}; 89};
85 90
86 91
@@ -214,7 +219,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
214 GNUNET_TESTBED_controller_stop (mc_proc); 219 GNUNET_TESTBED_controller_stop (mc_proc);
215 if (NULL != cfg) 220 if (NULL != cfg)
216 GNUNET_CONFIGURATION_destroy (cfg); 221 GNUNET_CONFIGURATION_destroy (cfg);
217 GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */ 222 GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */
218} 223}
219 224
220 225
@@ -249,6 +254,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
249 struct DLLOperation *dll_op = cls; 254 struct DLLOperation *dll_op = cls;
250 struct GNUNET_TESTBED_Peer **peer_ptr; 255 struct GNUNET_TESTBED_Peer **peer_ptr;
251 static unsigned int created_peers; 256 static unsigned int created_peers;
257 unsigned int peer_cnt;
252 258
253 if (NULL != emsg) 259 if (NULL != emsg)
254 { 260 {
@@ -273,6 +279,13 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
273 printf ("All peers created successfully in %.2f seconds\n", 279 printf ("All peers created successfully in %.2f seconds\n",
274 ((double) prof_time.rel_value) / 1000.00); 280 ((double) prof_time.rel_value) / 1000.00);
275 /* Now peers are to be started */ 281 /* Now peers are to be started */
282 state = STATE_PEERS_STARTING;
283 for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++)
284 {
285 dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
286 dll_op->op = GNUNET_TESTBED_peer_start (peers[peer_cnt], NULL, NULL);
287 GNUNET_CONTAINER_DLL_insert_tail (dll_op_head, dll_op_tail, dll_op);
288 }
276 } 289 }
277} 290}
278 291
@@ -299,11 +312,11 @@ controller_event_cb (void *cls,
299 { 312 {
300 static unsigned int slaves_started; 313 static unsigned int slaves_started;
301 unsigned int peer_cnt; 314 unsigned int peer_cnt;
302 315
303 dll_op = event->details.operation_finished.op_cls; 316 dll_op = event->details.operation_finished.op_cls;
304 GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op); 317 GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op);
305 GNUNET_free (dll_op); 318 GNUNET_free (dll_op);
306 op = event->details.operation_finished.operation; 319 op = event->details.operation_finished.operation;
307 if (NULL != event->details.operation_finished.emsg) 320 if (NULL != event->details.operation_finished.emsg)
308 { 321 {
309 LOG (GNUNET_ERROR_TYPE_WARNING, 322 LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -341,6 +354,20 @@ controller_event_cb (void *cls,
341 GNUNET_assert (0); 354 GNUNET_assert (0);
342 } 355 }
343 break; 356 break;
357 case STATE_PEERS_STARTING:
358 switch (event->type)
359 {
360 case GNUNET_TESTBED_ET_OPERATION_FINISHED:
361 /* Control reaches here when peer start fails */
362 GNUNET_break (0);
363 break;
364 case GNUNET_TESTBED_ET_PEER_START:
365 GNUNET_break (0);
366 break;
367 default:
368 GNUNET_assert (0);
369 }
370 break;
344 default: 371 default:
345 GNUNET_assert (0); 372 GNUNET_assert (0);
346 } 373 }