aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2012-09-09 12:30:54 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2012-09-09 12:30:54 +0000
commitbe8eb85b534cdf381b152df5c2e7907ada2fa19c (patch)
tree0ae15b2f388a1a9a0a45f95903b2e0b78513c19a /src/testbed
parent4ada29764b7ac7111a405eeef5130815ec0926ef (diff)
-adding continuation to testbed peer start/stop API
git-svn-id: https://gnunet.org/svn/gnunet@23719 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/test_testbed_api.c4
-rw-r--r--src/testbed/test_testbed_api_2peers.c6
-rw-r--r--src/testbed/test_testbed_api_controllerlink.c8
-rw-r--r--src/testbed/test_testbed_api_testbed_run.c2
-rw-r--r--src/testbed/testbed_api_peers.c16
-rw-r--r--src/testbed/testbed_api_testbed.c4
6 files changed, 25 insertions, 15 deletions
diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c
index b2a07650af..e44bf8b57e 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)
dht_handle = NULL;
GNUNET_assert (PEER_SERVICE_CONNECT == sub_test);
GNUNET_assert (NULL != operation);
- operation = GNUNET_TESTBED_peer_stop (peer);
+ operation = GNUNET_TESTBED_peer_stop (peer, NULL, NULL);
GNUNET_assert (NULL != operation);
}
@@ -355,7 +355,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
GNUNET_assert (NULL != peer_ptr);
*peer_ptr = peer;
GNUNET_TESTBED_operation_done (operation);
- operation = GNUNET_TESTBED_peer_start (peer);
+ operation = GNUNET_TESTBED_peer_start (peer, NULL, NULL);
GNUNET_assert (NULL != operation);
}
diff --git a/src/testbed/test_testbed_api_2peers.c b/src/testbed/test_testbed_api_2peers.c
index 63810187b4..43becddba7 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)
common_operation = NULL;
result = PEERS_CONNECTED;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n");
- peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer);
- peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer);
+ peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer, NULL, NULL);
+ peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer, NULL, NULL);
}
@@ -333,7 +333,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
GNUNET_assert (NULL == pc->peer);
pc->peer = peer;
GNUNET_TESTBED_operation_done (pc->operation);
- pc->operation = GNUNET_TESTBED_peer_start (pc->peer);
+ pc->operation = GNUNET_TESTBED_peer_start (pc->peer, NULL, NULL);
}
diff --git a/src/testbed/test_testbed_api_controllerlink.c b/src/testbed/test_testbed_api_controllerlink.c
index ee62bf1aa6..221de8f4d0 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)
switch (result)
{
case SLAVE1_PEER_START_SUCCESS:
- op = GNUNET_TESTBED_peer_stop (slave1_peer);
+ op = GNUNET_TESTBED_peer_stop (slave1_peer, NULL, NULL);
GNUNET_assert (NULL != op);
break;
case SLAVE2_PEER_START_SUCCESS:
- op = GNUNET_TESTBED_peer_stop (slave2_peer);
+ op = GNUNET_TESTBED_peer_stop (slave2_peer, NULL, NULL);
GNUNET_assert (NULL != op);
break;
default:
@@ -282,7 +282,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
result = SLAVE2_PEER_CREATE_SUCCESS;
slave2_peer = peer;
GNUNET_TESTBED_operation_done (op);
- op = GNUNET_TESTBED_peer_start (slave1_peer);
+ op = GNUNET_TESTBED_peer_start (slave1_peer, NULL, NULL);
GNUNET_assert (NULL != op);
break;
default:
@@ -354,7 +354,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
GNUNET_assert (event->details.peer_stop.peer == slave1_peer);
GNUNET_TESTBED_operation_done (op);
result = SLAVE1_PEER_STOP_SUCCESS;
- op = GNUNET_TESTBED_peer_start (slave2_peer);
+ op = GNUNET_TESTBED_peer_start (slave2_peer, NULL, NULL);
GNUNET_assert (NULL != op);
break;
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 b8bca508d8..82734d7e96 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)
{
result = GNUNET_OK;
GNUNET_assert (NULL != peers[0]);
- op = GNUNET_TESTBED_peer_stop (peers[0]);
+ op = GNUNET_TESTBED_peer_stop (peers[0], NULL, NULL);
GNUNET_assert (NULL != op);
}
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c
index 619212def3..86bc6f2e2e 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,
* Start the given peer.
*
* @param peer peer to start
+ * @param pcc function to call upon completion
+ * @param pcc_cls closure for 'pcc'
* @return handle to the operation
*/
struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer)
+GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer,
+ GNUNET_TESTBED_PeerChurnCallback pcc,
+ void *pcc_cls)
{
struct OperationContext *opc;
-
+
+ // FIXME: keep and call pcc!
opc = GNUNET_malloc (sizeof (struct OperationContext));
opc->c = peer->controller;
opc->data = peer;
@@ -510,13 +515,18 @@ GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer)
* state of the peer).
*
* @param peer peer to stop
+ * @param pcc function to call upon completion
+ * @param pcc_cls closure for 'pcc'
* @return handle to the operation
*/
struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer)
+GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer,
+ GNUNET_TESTBED_PeerChurnCallback pcc,
+ void *pcc_cls)
{
struct OperationContext *opc;
+ // FIXME: keep and call pcc!
opc = GNUNET_malloc (sizeof (struct OperationContext));
opc->c = peer->controller;
opc->data = peer;
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c
index bc89638a43..9a97dec26d 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)
for (peer = 0; peer < rc->num_peers; peer++)
{
dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
- dll_op->op = GNUNET_TESTBED_peer_start (rc->peers[peer]);
+ dll_op->op = GNUNET_TESTBED_peer_start (rc->peers[peer], NULL, NULL);
dll_op->cls = rc->peers[peer];
GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, dll_op);
}
@@ -436,7 +436,7 @@ shutdown_run_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
continue;
}
dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
- dll_op->op = GNUNET_TESTBED_peer_stop (rc->peers[peer]);
+ dll_op->op = GNUNET_TESTBED_peer_stop (rc->peers[peer], NULL, NULL);
dll_op->cls = rc->peers[peer];
GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail,
dll_op);