aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/test_testbed_api_2peers_1controller.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-01-07 16:37:24 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-01-07 16:37:24 +0000
commiteb0d78ddbb8884c441a3467df62659be27384056 (patch)
tree617f4907ac6448026f64b9a2d1d9f8a9507bd779 /src/testbed/test_testbed_api_2peers_1controller.c
parent0a67f09f0ecd7d01c304bf22e56a63d479ba4e42 (diff)
downloadgnunet-eb0d78ddbb8884c441a3467df62659be27384056.tar.gz
gnunet-eb0d78ddbb8884c441a3467df62659be27384056.zip
- call controller callback before operation completion callback; only way to ensure that GNUNET_TESTBED_operation_done() on GNUNET_TESTBED_underlay_configure_topology() operations doesn't result in segfault.
Diffstat (limited to 'src/testbed/test_testbed_api_2peers_1controller.c')
-rw-r--r--src/testbed/test_testbed_api_2peers_1controller.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/testbed/test_testbed_api_2peers_1controller.c b/src/testbed/test_testbed_api_2peers_1controller.c
index 882a467b3..084df1007 100644
--- a/src/testbed/test_testbed_api_2peers_1controller.c
+++ b/src/testbed/test_testbed_api_2peers_1controller.c
@@ -265,24 +265,11 @@ op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
265 FAIL_TEST (NULL == peer1.operation); 265 FAIL_TEST (NULL == peer1.operation);
266 FAIL_TEST (NULL == peer2.operation); 266 FAIL_TEST (NULL == peer2.operation);
267 FAIL_TEST (NULL != common_operation); 267 FAIL_TEST (NULL != common_operation);
268 GNUNET_TESTBED_operation_done (common_operation);
269 common_operation = NULL;
270 result = PEERS_CONNECTED;
271 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n");
272 delayed_connect_task =
273 GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (3),
274 &do_delayed_connect, NULL);
275 break; 268 break;
276 case PEERS_CONNECTED: 269 case PEERS_CONNECTED:
277 FAIL_TEST (NULL == peer1.operation); 270 FAIL_TEST (NULL == peer1.operation);
278 FAIL_TEST (NULL == peer2.operation); 271 FAIL_TEST (NULL == peer2.operation);
279 FAIL_TEST (NULL != common_operation); 272 FAIL_TEST (NULL != common_operation);
280 GNUNET_TESTBED_operation_done (common_operation);
281 common_operation = NULL;
282 result = PEERS_CONNECTED_2;
283 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected again\n");
284 peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer, NULL, NULL);
285 peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer, NULL, NULL);
286 break; 273 break;
287 default: 274 default:
288 FAIL_TEST (0); 275 FAIL_TEST (0);
@@ -375,12 +362,29 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
375 switch (result) 362 switch (result)
376 { 363 {
377 case PEERS_STARTED: 364 case PEERS_STARTED:
378 case PEERS_CONNECTED:
379 FAIL_TEST (NULL == peer1.operation); 365 FAIL_TEST (NULL == peer1.operation);
380 FAIL_TEST (NULL == peer2.operation); 366 FAIL_TEST (NULL == peer2.operation);
381 FAIL_TEST (NULL != common_operation); 367 FAIL_TEST (NULL != common_operation);
382 FAIL_TEST ((event->details.peer_connect.peer1 == peer1.peer) && 368 FAIL_TEST ((event->details.peer_connect.peer1 == peer1.peer) &&
383 (event->details.peer_connect.peer2 == peer2.peer)); 369 (event->details.peer_connect.peer2 == peer2.peer));
370 GNUNET_TESTBED_operation_done (common_operation);
371 common_operation = NULL;
372 result = PEERS_CONNECTED;
373 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n");
374 delayed_connect_task =
375 GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (3),
376 &do_delayed_connect, NULL);
377 break;
378 case PEERS_CONNECTED:
379 FAIL_TEST (NULL == peer1.operation);
380 FAIL_TEST (NULL == peer2.operation);
381 FAIL_TEST (NULL != common_operation);
382 GNUNET_TESTBED_operation_done (common_operation);
383 common_operation = NULL;
384 result = PEERS_CONNECTED_2;
385 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected again\n");
386 peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer, NULL, NULL);
387 peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer, NULL, NULL);
384 break; 388 break;
385 default: 389 default:
386 FAIL_TEST (0); 390 FAIL_TEST (0);