diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-09-09 13:46:21 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-09-09 13:46:21 +0000 |
commit | e418b158990b8368d4577edc17c75683bb9e087c (patch) | |
tree | 94c970fb413547cc24e1d7f12d9949caae704d6c /src/testbed/testbed_api.c | |
parent | 2db24ba3a4dc97e08c9eb2c3d0723ab445dcf0c3 (diff) | |
download | gnunet-e418b158990b8368d4577edc17c75683bb9e087c.tar.gz gnunet-e418b158990b8368d4577edc17c75683bb9e087c.zip |
implemented continuations to testbed peer start/stop API
Diffstat (limited to 'src/testbed/testbed_api.c')
-rw-r--r-- | src/testbed/testbed_api.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index 665c19486..d83793ac5 100644 --- a/src/testbed/testbed_api.c +++ b/src/testbed/testbed_api.c | |||
@@ -410,6 +410,9 @@ handle_peer_event (struct GNUNET_TESTBED_Controller *c, | |||
410 | { | 410 | { |
411 | struct OperationContext *opc; | 411 | struct OperationContext *opc; |
412 | struct GNUNET_TESTBED_Peer *peer; | 412 | struct GNUNET_TESTBED_Peer *peer; |
413 | struct PeerEventData *data; | ||
414 | GNUNET_TESTBED_PeerChurnCallback pcc; | ||
415 | void *pcc_cls; | ||
413 | struct GNUNET_TESTBED_EventInformation event; | 416 | struct GNUNET_TESTBED_EventInformation event; |
414 | uint64_t op_id; | 417 | uint64_t op_id; |
415 | 418 | ||
@@ -434,7 +437,9 @@ handle_peer_event (struct GNUNET_TESTBED_Controller *c, | |||
434 | return GNUNET_YES; | 437 | return GNUNET_YES; |
435 | } | 438 | } |
436 | GNUNET_assert ((OP_PEER_START == opc->type) || (OP_PEER_STOP == opc->type)); | 439 | GNUNET_assert ((OP_PEER_START == opc->type) || (OP_PEER_STOP == opc->type)); |
437 | peer = opc->data; | 440 | data = opc->data; |
441 | GNUNET_assert (NULL != data); | ||
442 | peer = data->peer; | ||
438 | GNUNET_assert (NULL != peer); | 443 | GNUNET_assert (NULL != peer); |
439 | event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type); | 444 | event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type); |
440 | switch (event.type) | 445 | switch (event.type) |
@@ -451,6 +456,9 @@ handle_peer_event (struct GNUNET_TESTBED_Controller *c, | |||
451 | default: | 456 | default: |
452 | GNUNET_assert (0); /* We should never reach this state */ | 457 | GNUNET_assert (0); /* We should never reach this state */ |
453 | } | 458 | } |
459 | pcc = data->pcc; | ||
460 | pcc_cls = data->pcc_cls; | ||
461 | GNUNET_free (data); | ||
454 | GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc); | 462 | GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc); |
455 | opc->state = OPC_STATE_FINISHED; | 463 | opc->state = OPC_STATE_FINISHED; |
456 | if (0 != | 464 | if (0 != |
@@ -460,6 +468,8 @@ handle_peer_event (struct GNUNET_TESTBED_Controller *c, | |||
460 | if (NULL != c->cc) | 468 | if (NULL != c->cc) |
461 | c->cc (c->cc_cls, &event); | 469 | c->cc (c->cc_cls, &event); |
462 | } | 470 | } |
471 | if (NULL != pcc) | ||
472 | pcc (pcc_cls, NULL); | ||
463 | return GNUNET_YES; | 473 | return GNUNET_YES; |
464 | } | 474 | } |
465 | 475 | ||