diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-09-09 12:30:54 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-09-09 12:30:54 +0000 |
commit | a1d7926951beb7466a1462e43b9933530e5825f7 (patch) | |
tree | 0ae15b2f388a1a9a0a45f95903b2e0b78513c19a /src/testbed | |
parent | 495ebe5987dbf7562d55e9d6a5751d78ae35ffc2 (diff) | |
download | gnunet-a1d7926951beb7466a1462e43b9933530e5825f7.tar.gz gnunet-a1d7926951beb7466a1462e43b9933530e5825f7.zip |
-adding continuation to testbed peer start/stop API
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/test_testbed_api.c | 4 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_2peers.c | 6 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_controllerlink.c | 8 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_testbed_run.c | 2 | ||||
-rw-r--r-- | src/testbed/testbed_api_peers.c | 16 | ||||
-rw-r--r-- | src/testbed/testbed_api_testbed.c | 4 |
6 files changed, 25 insertions, 15 deletions
diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c index b2a07650a..e44bf8b57 100644 --- a/src/testbed/test_testbed_api.c +++ b/src/testbed/test_testbed_api.c | |||
@@ -204,7 +204,7 @@ dht_disconnect_adapter (void *cls, void *op_result) | |||
204 | dht_handle = NULL; | 204 | dht_handle = NULL; |
205 | GNUNET_assert (PEER_SERVICE_CONNECT == sub_test); | 205 | GNUNET_assert (PEER_SERVICE_CONNECT == sub_test); |
206 | GNUNET_assert (NULL != operation); | 206 | GNUNET_assert (NULL != operation); |
207 | operation = GNUNET_TESTBED_peer_stop (peer); | 207 | operation = GNUNET_TESTBED_peer_stop (peer, NULL, NULL); |
208 | GNUNET_assert (NULL != operation); | 208 | GNUNET_assert (NULL != operation); |
209 | } | 209 | } |
210 | 210 | ||
@@ -355,7 +355,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
355 | GNUNET_assert (NULL != peer_ptr); | 355 | GNUNET_assert (NULL != peer_ptr); |
356 | *peer_ptr = peer; | 356 | *peer_ptr = peer; |
357 | GNUNET_TESTBED_operation_done (operation); | 357 | GNUNET_TESTBED_operation_done (operation); |
358 | operation = GNUNET_TESTBED_peer_start (peer); | 358 | operation = GNUNET_TESTBED_peer_start (peer, NULL, NULL); |
359 | GNUNET_assert (NULL != operation); | 359 | GNUNET_assert (NULL != operation); |
360 | } | 360 | } |
361 | 361 | ||
diff --git a/src/testbed/test_testbed_api_2peers.c b/src/testbed/test_testbed_api_2peers.c index 63810187b..43becddba 100644 --- a/src/testbed/test_testbed_api_2peers.c +++ b/src/testbed/test_testbed_api_2peers.c | |||
@@ -214,8 +214,8 @@ op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) | |||
214 | common_operation = NULL; | 214 | common_operation = NULL; |
215 | result = PEERS_CONNECTED; | 215 | result = PEERS_CONNECTED; |
216 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n"); | 216 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n"); |
217 | peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer); | 217 | peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer, NULL, NULL); |
218 | peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer); | 218 | peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer, NULL, NULL); |
219 | } | 219 | } |
220 | 220 | ||
221 | 221 | ||
@@ -333,7 +333,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
333 | GNUNET_assert (NULL == pc->peer); | 333 | GNUNET_assert (NULL == pc->peer); |
334 | pc->peer = peer; | 334 | pc->peer = peer; |
335 | GNUNET_TESTBED_operation_done (pc->operation); | 335 | GNUNET_TESTBED_operation_done (pc->operation); |
336 | pc->operation = GNUNET_TESTBED_peer_start (pc->peer); | 336 | pc->operation = GNUNET_TESTBED_peer_start (pc->peer, NULL, NULL); |
337 | } | 337 | } |
338 | 338 | ||
339 | 339 | ||
diff --git a/src/testbed/test_testbed_api_controllerlink.c b/src/testbed/test_testbed_api_controllerlink.c index ee62bf1aa..221de8f4d 100644 --- a/src/testbed/test_testbed_api_controllerlink.c +++ b/src/testbed/test_testbed_api_controllerlink.c | |||
@@ -240,11 +240,11 @@ delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
240 | switch (result) | 240 | switch (result) |
241 | { | 241 | { |
242 | case SLAVE1_PEER_START_SUCCESS: | 242 | case SLAVE1_PEER_START_SUCCESS: |
243 | op = GNUNET_TESTBED_peer_stop (slave1_peer); | 243 | op = GNUNET_TESTBED_peer_stop (slave1_peer, NULL, NULL); |
244 | GNUNET_assert (NULL != op); | 244 | GNUNET_assert (NULL != op); |
245 | break; | 245 | break; |
246 | case SLAVE2_PEER_START_SUCCESS: | 246 | case SLAVE2_PEER_START_SUCCESS: |
247 | op = GNUNET_TESTBED_peer_stop (slave2_peer); | 247 | op = GNUNET_TESTBED_peer_stop (slave2_peer, NULL, NULL); |
248 | GNUNET_assert (NULL != op); | 248 | GNUNET_assert (NULL != op); |
249 | break; | 249 | break; |
250 | default: | 250 | default: |
@@ -282,7 +282,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
282 | result = SLAVE2_PEER_CREATE_SUCCESS; | 282 | result = SLAVE2_PEER_CREATE_SUCCESS; |
283 | slave2_peer = peer; | 283 | slave2_peer = peer; |
284 | GNUNET_TESTBED_operation_done (op); | 284 | GNUNET_TESTBED_operation_done (op); |
285 | op = GNUNET_TESTBED_peer_start (slave1_peer); | 285 | op = GNUNET_TESTBED_peer_start (slave1_peer, NULL, NULL); |
286 | GNUNET_assert (NULL != op); | 286 | GNUNET_assert (NULL != op); |
287 | break; | 287 | break; |
288 | default: | 288 | default: |
@@ -354,7 +354,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | |||
354 | GNUNET_assert (event->details.peer_stop.peer == slave1_peer); | 354 | GNUNET_assert (event->details.peer_stop.peer == slave1_peer); |
355 | GNUNET_TESTBED_operation_done (op); | 355 | GNUNET_TESTBED_operation_done (op); |
356 | result = SLAVE1_PEER_STOP_SUCCESS; | 356 | result = SLAVE1_PEER_STOP_SUCCESS; |
357 | op = GNUNET_TESTBED_peer_start (slave2_peer); | 357 | op = GNUNET_TESTBED_peer_start (slave2_peer, NULL, NULL); |
358 | GNUNET_assert (NULL != op); | 358 | GNUNET_assert (NULL != op); |
359 | break; | 359 | break; |
360 | case SLAVE1_PEER_STOP_SUCCESS: | 360 | case SLAVE1_PEER_STOP_SUCCESS: |
diff --git a/src/testbed/test_testbed_api_testbed_run.c b/src/testbed/test_testbed_api_testbed_run.c index b8bca508d..82734d7e9 100644 --- a/src/testbed/test_testbed_api_testbed_run.c +++ b/src/testbed/test_testbed_api_testbed_run.c | |||
@@ -101,7 +101,7 @@ master_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
101 | { | 101 | { |
102 | result = GNUNET_OK; | 102 | result = GNUNET_OK; |
103 | GNUNET_assert (NULL != peers[0]); | 103 | GNUNET_assert (NULL != peers[0]); |
104 | op = GNUNET_TESTBED_peer_stop (peers[0]); | 104 | op = GNUNET_TESTBED_peer_stop (peers[0], NULL, NULL); |
105 | GNUNET_assert (NULL != op); | 105 | GNUNET_assert (NULL != op); |
106 | } | 106 | } |
107 | 107 | ||
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c index 619212def..86bc6f2e2 100644 --- a/src/testbed/testbed_api_peers.c +++ b/src/testbed/testbed_api_peers.c | |||
@@ -483,13 +483,18 @@ GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller, | |||
483 | * Start the given peer. | 483 | * Start the given peer. |
484 | * | 484 | * |
485 | * @param peer peer to start | 485 | * @param peer peer to start |
486 | * @param pcc function to call upon completion | ||
487 | * @param pcc_cls closure for 'pcc' | ||
486 | * @return handle to the operation | 488 | * @return handle to the operation |
487 | */ | 489 | */ |
488 | struct GNUNET_TESTBED_Operation * | 490 | struct GNUNET_TESTBED_Operation * |
489 | GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer) | 491 | GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer, |
492 | GNUNET_TESTBED_PeerChurnCallback pcc, | ||
493 | void *pcc_cls) | ||
490 | { | 494 | { |
491 | struct OperationContext *opc; | 495 | struct OperationContext *opc; |
492 | 496 | ||
497 | // FIXME: keep and call pcc! | ||
493 | opc = GNUNET_malloc (sizeof (struct OperationContext)); | 498 | opc = GNUNET_malloc (sizeof (struct OperationContext)); |
494 | opc->c = peer->controller; | 499 | opc->c = peer->controller; |
495 | opc->data = peer; | 500 | opc->data = peer; |
@@ -510,13 +515,18 @@ GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer) | |||
510 | * state of the peer). | 515 | * state of the peer). |
511 | * | 516 | * |
512 | * @param peer peer to stop | 517 | * @param peer peer to stop |
518 | * @param pcc function to call upon completion | ||
519 | * @param pcc_cls closure for 'pcc' | ||
513 | * @return handle to the operation | 520 | * @return handle to the operation |
514 | */ | 521 | */ |
515 | struct GNUNET_TESTBED_Operation * | 522 | struct GNUNET_TESTBED_Operation * |
516 | GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer) | 523 | GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer, |
524 | GNUNET_TESTBED_PeerChurnCallback pcc, | ||
525 | void *pcc_cls) | ||
517 | { | 526 | { |
518 | struct OperationContext *opc; | 527 | struct OperationContext *opc; |
519 | 528 | ||
529 | // FIXME: keep and call pcc! | ||
520 | opc = GNUNET_malloc (sizeof (struct OperationContext)); | 530 | opc = GNUNET_malloc (sizeof (struct OperationContext)); |
521 | opc->c = peer->controller; | 531 | opc->c = peer->controller; |
522 | opc->data = peer; | 532 | opc->data = peer; |
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index bc89638a4..9a97dec26 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c | |||
@@ -199,7 +199,7 @@ start_peers_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
199 | for (peer = 0; peer < rc->num_peers; peer++) | 199 | for (peer = 0; peer < rc->num_peers; peer++) |
200 | { | 200 | { |
201 | dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); | 201 | dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); |
202 | dll_op->op = GNUNET_TESTBED_peer_start (rc->peers[peer]); | 202 | dll_op->op = GNUNET_TESTBED_peer_start (rc->peers[peer], NULL, NULL); |
203 | dll_op->cls = rc->peers[peer]; | 203 | dll_op->cls = rc->peers[peer]; |
204 | GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, dll_op); | 204 | GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, dll_op); |
205 | } | 205 | } |
@@ -436,7 +436,7 @@ shutdown_run_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
436 | continue; | 436 | continue; |
437 | } | 437 | } |
438 | dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); | 438 | dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); |
439 | dll_op->op = GNUNET_TESTBED_peer_stop (rc->peers[peer]); | 439 | dll_op->op = GNUNET_TESTBED_peer_stop (rc->peers[peer], NULL, NULL); |
440 | dll_op->cls = rc->peers[peer]; | 440 | dll_op->cls = rc->peers[peer]; |
441 | GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, | 441 | GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, |
442 | dll_op); | 442 | dll_op); |