diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-14 12:21:48 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-14 12:21:48 +0000 |
commit | 75357bec5d503045dcf5d5cfd5805300e0605d9d (patch) | |
tree | 95508483a8285f39068282002ca85cc114446818 | |
parent | 27fcf1fd9a5800ff97eaf8d9863ba48614b378d0 (diff) | |
download | gnunet-75357bec5d503045dcf5d5cfd5805300e0605d9d.tar.gz gnunet-75357bec5d503045dcf5d5cfd5805300e0605d9d.zip |
operation closure in peer start
-rw-r--r-- | src/include/gnunet_testbed_service.h | 5 | ||||
-rw-r--r-- | src/nse/gnunet-nse-profiler.c | 2 | ||||
-rw-r--r-- | src/regex/test_regex_big.c | 2 | ||||
-rw-r--r-- | src/testbed/gnunet-testbed-profiler.c | 2 | ||||
-rw-r--r-- | src/testbed/test_testbed_api.c | 2 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_2peers_1controller.c | 2 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_3peers_3controllers.c | 6 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_controllerlink.c | 6 | ||||
-rw-r--r-- | src/testbed/testbed_api_peers.c | 6 | ||||
-rw-r--r-- | src/testbed/testbed_api_testbed.c | 2 |
10 files changed, 21 insertions, 14 deletions
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index ea1765946..7953feb6e 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h | |||
@@ -705,13 +705,16 @@ typedef void (*GNUNET_TESTBED_PeerChurnCallback) (void *cls, | |||
705 | /** | 705 | /** |
706 | * Start the given peer. | 706 | * Start the given peer. |
707 | * | 707 | * |
708 | * @param op_cls the closure for this operation; will be set in | ||
709 | * event->details.operation_finished.op_cls when this operation fails. | ||
708 | * @param peer peer to start | 710 | * @param peer peer to start |
709 | * @param pcc function to call upon completion | 711 | * @param pcc function to call upon completion |
710 | * @param pcc_cls closure for 'pcc' | 712 | * @param pcc_cls closure for 'pcc' |
711 | * @return handle to the operation | 713 | * @return handle to the operation |
712 | */ | 714 | */ |
713 | struct GNUNET_TESTBED_Operation * | 715 | struct GNUNET_TESTBED_Operation * |
714 | GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer, | 716 | GNUNET_TESTBED_peer_start (void *op_cls, |
717 | struct GNUNET_TESTBED_Peer *peer, | ||
715 | GNUNET_TESTBED_PeerChurnCallback pcc, | 718 | GNUNET_TESTBED_PeerChurnCallback pcc, |
716 | void *pcc_cls); | 719 | void *pcc_cls); |
717 | 720 | ||
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c index 949006c2b..40c1f5d69 100644 --- a/src/nse/gnunet-nse-profiler.c +++ b/src/nse/gnunet-nse-profiler.c | |||
@@ -836,7 +836,7 @@ next_round (void *cls, | |||
836 | 836 | ||
837 | /* start peers if we have too few */ | 837 | /* start peers if we have too few */ |
838 | for (i=peers_running;i<num_peers_in_round[current_round];i++) | 838 | for (i=peers_running;i<num_peers_in_round[current_round];i++) |
839 | GNUNET_TESTBED_peer_start (daemons[i], NULL, NULL); | 839 | GNUNET_TESTBED_peer_start (NULL, daemons[i], NULL, NULL); |
840 | 840 | ||
841 | /* stop peers if we have too many */ | 841 | /* stop peers if we have too many */ |
842 | for (i=num_peers_in_round[current_round];i<peers_running;i++) | 842 | for (i=num_peers_in_round[current_round];i<peers_running;i++) |
diff --git a/src/regex/test_regex_big.c b/src/regex/test_regex_big.c index 457a358b4..c044263e1 100644 --- a/src/regex/test_regex_big.c +++ b/src/regex/test_regex_big.c | |||
@@ -434,7 +434,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
434 | peer_id = i; // FIXME A * i + B | 434 | peer_id = i; // FIXME A * i + B |
435 | peers[peer_id] = peer; | 435 | peers[peer_id] = peer; |
436 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Peer %i created\n", peer_id); | 436 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Peer %i created\n", peer_id); |
437 | op[i] = GNUNET_TESTBED_peer_start (peer, peer_start_cb, (void *) i); | 437 | op[i] = GNUNET_TESTBED_peer_start (NULL, peer, peer_start_cb, (void *) i); |
438 | } | 438 | } |
439 | 439 | ||
440 | 440 | ||
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index 93d7ea70c..4144c3da5 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c | |||
@@ -283,7 +283,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
283 | for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++) | 283 | for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++) |
284 | { | 284 | { |
285 | dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); | 285 | dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); |
286 | dll_op->op = GNUNET_TESTBED_peer_start (peers[peer_cnt], NULL, NULL); | 286 | dll_op->op = GNUNET_TESTBED_peer_start (NULL, peers[peer_cnt], NULL, NULL); |
287 | GNUNET_CONTAINER_DLL_insert_tail (dll_op_head, dll_op_tail, dll_op); | 287 | GNUNET_CONTAINER_DLL_insert_tail (dll_op_head, dll_op_tail, dll_op); |
288 | } | 288 | } |
289 | } | 289 | } |
diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c index 0fb745a1c..694d06274 100644 --- a/src/testbed/test_testbed_api.c +++ b/src/testbed/test_testbed_api.c | |||
@@ -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, NULL, NULL); | 358 | operation = GNUNET_TESTBED_peer_start (NULL, 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_1controller.c b/src/testbed/test_testbed_api_2peers_1controller.c index d0638d564..9aa306a4b 100644 --- a/src/testbed/test_testbed_api_2peers_1controller.c +++ b/src/testbed/test_testbed_api_2peers_1controller.c | |||
@@ -399,7 +399,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
399 | GNUNET_assert (NULL == pc->peer); | 399 | GNUNET_assert (NULL == pc->peer); |
400 | pc->peer = peer; | 400 | pc->peer = peer; |
401 | GNUNET_TESTBED_operation_done (pc->operation); | 401 | GNUNET_TESTBED_operation_done (pc->operation); |
402 | pc->operation = GNUNET_TESTBED_peer_start (pc->peer, NULL, NULL); | 402 | pc->operation = GNUNET_TESTBED_peer_start (NULL, pc->peer, NULL, NULL); |
403 | } | 403 | } |
404 | 404 | ||
405 | 405 | ||
diff --git a/src/testbed/test_testbed_api_3peers_3controllers.c b/src/testbed/test_testbed_api_3peers_3controllers.c index b79271489..ed70fba6a 100644 --- a/src/testbed/test_testbed_api_3peers_3controllers.c +++ b/src/testbed/test_testbed_api_3peers_3controllers.c | |||
@@ -388,7 +388,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
388 | peer1.peer = peer; | 388 | peer1.peer = peer; |
389 | GNUNET_TESTBED_operation_done (peer1.operation); | 389 | GNUNET_TESTBED_operation_done (peer1.operation); |
390 | result = PEER1_CREATED; | 390 | result = PEER1_CREATED; |
391 | peer1.operation = GNUNET_TESTBED_peer_start (peer, NULL, NULL); | 391 | peer1.operation = GNUNET_TESTBED_peer_start (NULL, peer, NULL, NULL); |
392 | break; | 392 | break; |
393 | case CONTROLLER2_UP: | 393 | case CONTROLLER2_UP: |
394 | GNUNET_assert (NULL != peer2.operation); | 394 | GNUNET_assert (NULL != peer2.operation); |
@@ -397,7 +397,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
397 | peer2.peer = peer; | 397 | peer2.peer = peer; |
398 | GNUNET_TESTBED_operation_done (peer2.operation); | 398 | GNUNET_TESTBED_operation_done (peer2.operation); |
399 | result = PEER2_CREATED; | 399 | result = PEER2_CREATED; |
400 | peer2.operation = GNUNET_TESTBED_peer_start (peer, NULL, NULL); | 400 | peer2.operation = GNUNET_TESTBED_peer_start (NULL, peer, NULL, NULL); |
401 | break; | 401 | break; |
402 | case CONTROLLER3_UP: | 402 | case CONTROLLER3_UP: |
403 | GNUNET_assert (NULL != peer3.operation); | 403 | GNUNET_assert (NULL != peer3.operation); |
@@ -406,7 +406,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
406 | peer3.peer = peer; | 406 | peer3.peer = peer; |
407 | GNUNET_TESTBED_operation_done (peer3.operation); | 407 | GNUNET_TESTBED_operation_done (peer3.operation); |
408 | result = PEER3_CREATED; | 408 | result = PEER3_CREATED; |
409 | peer3.operation = GNUNET_TESTBED_peer_start (peer, NULL, NULL); | 409 | peer3.operation = GNUNET_TESTBED_peer_start (NULL, peer, NULL, NULL); |
410 | break; | 410 | break; |
411 | default: | 411 | default: |
412 | GNUNET_assert (0); | 412 | GNUNET_assert (0); |
diff --git a/src/testbed/test_testbed_api_controllerlink.c b/src/testbed/test_testbed_api_controllerlink.c index aa3a49928..703815a2d 100644 --- a/src/testbed/test_testbed_api_controllerlink.c +++ b/src/testbed/test_testbed_api_controllerlink.c | |||
@@ -355,7 +355,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
355 | result = MASTER_PEER_CREATE_SUCCESS; | 355 | result = MASTER_PEER_CREATE_SUCCESS; |
356 | master_peer = peer; | 356 | master_peer = peer; |
357 | GNUNET_TESTBED_operation_done (op); | 357 | GNUNET_TESTBED_operation_done (op); |
358 | op = GNUNET_TESTBED_peer_start (master_peer, NULL, NULL); | 358 | op = GNUNET_TESTBED_peer_start (NULL, master_peer, NULL, NULL); |
359 | break; | 359 | break; |
360 | case SLAVE2_LINK_SUCCESS: | 360 | case SLAVE2_LINK_SUCCESS: |
361 | result = SLAVE1_PEER_CREATE_SUCCESS; | 361 | result = SLAVE1_PEER_CREATE_SUCCESS; |
@@ -367,7 +367,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
367 | result = SLAVE2_PEER_CREATE_SUCCESS; | 367 | result = SLAVE2_PEER_CREATE_SUCCESS; |
368 | slave2_peer = peer; | 368 | slave2_peer = peer; |
369 | GNUNET_TESTBED_operation_done (op); | 369 | GNUNET_TESTBED_operation_done (op); |
370 | op = GNUNET_TESTBED_peer_start (slave1_peer, NULL, NULL); | 370 | op = GNUNET_TESTBED_peer_start (NULL, slave1_peer, NULL, NULL); |
371 | break; | 371 | break; |
372 | default: | 372 | default: |
373 | GNUNET_assert (0); | 373 | GNUNET_assert (0); |
@@ -460,7 +460,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | |||
460 | GNUNET_assert (event->details.peer_stop.peer == slave1_peer); | 460 | GNUNET_assert (event->details.peer_stop.peer == slave1_peer); |
461 | GNUNET_TESTBED_operation_done (op); | 461 | GNUNET_TESTBED_operation_done (op); |
462 | result = SLAVE1_PEER_STOP_SUCCESS; | 462 | result = SLAVE1_PEER_STOP_SUCCESS; |
463 | op = GNUNET_TESTBED_peer_start (slave2_peer, NULL, NULL); | 463 | op = GNUNET_TESTBED_peer_start (NULL, slave2_peer, NULL, NULL); |
464 | GNUNET_assert (NULL != op); | 464 | GNUNET_assert (NULL != op); |
465 | break; | 465 | break; |
466 | case SLAVE1_PEER_STOP_SUCCESS: | 466 | case SLAVE1_PEER_STOP_SUCCESS: |
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c index f9d0929ef..c85687e58 100644 --- a/src/testbed/testbed_api_peers.c +++ b/src/testbed/testbed_api_peers.c | |||
@@ -495,13 +495,16 @@ GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller, | |||
495 | /** | 495 | /** |
496 | * Start the given peer. | 496 | * Start the given peer. |
497 | * | 497 | * |
498 | * @param op_cls the closure for this operation; will be set in | ||
499 | * event->details.operation_finished.op_cls when this operation fails. | ||
498 | * @param peer peer to start | 500 | * @param peer peer to start |
499 | * @param pcc function to call upon completion | 501 | * @param pcc function to call upon completion |
500 | * @param pcc_cls closure for 'pcc' | 502 | * @param pcc_cls closure for 'pcc' |
501 | * @return handle to the operation | 503 | * @return handle to the operation |
502 | */ | 504 | */ |
503 | struct GNUNET_TESTBED_Operation * | 505 | struct GNUNET_TESTBED_Operation * |
504 | GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer, | 506 | GNUNET_TESTBED_peer_start (void *op_cls, |
507 | struct GNUNET_TESTBED_Peer *peer, | ||
505 | GNUNET_TESTBED_PeerChurnCallback pcc, | 508 | GNUNET_TESTBED_PeerChurnCallback pcc, |
506 | void *pcc_cls) | 509 | void *pcc_cls) |
507 | { | 510 | { |
@@ -515,6 +518,7 @@ GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer, | |||
515 | opc = GNUNET_malloc (sizeof (struct OperationContext)); | 518 | opc = GNUNET_malloc (sizeof (struct OperationContext)); |
516 | opc->c = peer->controller; | 519 | opc->c = peer->controller; |
517 | opc->data = data; | 520 | opc->data = data; |
521 | opc->op_cls = op_cls; | ||
518 | opc->id = GNUNET_TESTBED_get_next_op_id (opc->c); | 522 | opc->id = GNUNET_TESTBED_get_next_op_id (opc->c); |
519 | opc->type = OP_PEER_START; | 523 | opc->type = OP_PEER_START; |
520 | opc->op = | 524 | opc->op = |
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index 2e597e2eb..02b20d214 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], NULL, NULL); | 202 | dll_op->op = GNUNET_TESTBED_peer_start (NULL, 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 | } |