[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23719 - in gnunet/src: include testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23719 - in gnunet/src: include testbed |
Date: |
Sun, 9 Sep 2012 14:30:54 +0200 |
Author: grothoff
Date: 2012-09-09 14:30:54 +0200 (Sun, 09 Sep 2012)
New Revision: 23719
Modified:
gnunet/src/include/gnunet_fs_service.h
gnunet/src/include/gnunet_testbed_service.h
gnunet/src/testbed/test_testbed_api.c
gnunet/src/testbed/test_testbed_api_2peers.c
gnunet/src/testbed/test_testbed_api_controllerlink.c
gnunet/src/testbed/test_testbed_api_testbed_run.c
gnunet/src/testbed/testbed_api_peers.c
gnunet/src/testbed/testbed_api_testbed.c
Log:
-adding continuation to testbed peer start/stop API
Modified: gnunet/src/include/gnunet_fs_service.h
===================================================================
--- gnunet/src/include/gnunet_fs_service.h 2012-09-09 07:27:05 UTC (rev
23718)
+++ gnunet/src/include/gnunet_fs_service.h 2012-09-09 12:30:54 UTC (rev
23719)
@@ -1542,8 +1542,7 @@
* field in the GNUNET_FS_ProgressInfo struct.
*/
typedef void *(*GNUNET_FS_ProgressCallback) (void *cls,
- const struct
GNUNET_FS_ProgressInfo
- * info);
+ const struct
GNUNET_FS_ProgressInfo *info);
/**
@@ -1570,30 +1569,31 @@
GNUNET_FS_FLAGS_DO_PROBES = 2
};
+
/**
* Options specified in the VARARGs portion of GNUNET_FS_start.
*/
enum GNUNET_FS_OPTIONS
{
- /**
- * Last option in the VARARG list.
- */
+ /**
+ * Last option in the VARARG list.
+ */
GNUNET_FS_OPTIONS_END = 0,
- /**
- * Select the desired amount of parallelism (this option should be
- * followed by an "unsigned int" giving the desired maximum number
- * of parallel downloads).
- */
+ /**
+ * Select the desired amount of parallelism (this option should be
+ * followed by an "unsigned int" giving the desired maximum number
+ * of parallel downloads).
+ */
GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1,
- /**
- * Maximum number of requests that should be pending at a given
- * point in time (invidivual downloads may go above this, but
- * if we are above this threshold, we should not activate any
- * additional downloads.
- */
+ /**
+ * Maximum number of requests that should be pending at a given
+ * point in time (invidivual downloads may go above this, but
+ * if we are above this threshold, we should not activate any
+ * additional downloads.
+ */
GNUNET_FS_OPTIONS_REQUEST_PARALLELISM = 2
};
Modified: gnunet/src/include/gnunet_testbed_service.h
===================================================================
--- gnunet/src/include/gnunet_testbed_service.h 2012-09-09 07:27:05 UTC (rev
23718)
+++ gnunet/src/include/gnunet_testbed_service.h 2012-09-09 12:30:54 UTC (rev
23719)
@@ -647,13 +647,28 @@
/**
+ * Functions of this signature are called when a peer has been successfully
+ * started or stopped.
+ *
+ * @param cls the closure from GNUNET_TESTBED_peer_start/stop()
+ * @param emsg NULL on success; otherwise an error description
+ */
+typedef void (*GNUNET_TESTBED_PeerChurnCallback) (void *cls,
+ const char *emsg);
+
+
+/**
* 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);
/**
@@ -662,10 +677,14 @@
* 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);
/**
Modified: gnunet/src/testbed/test_testbed_api.c
===================================================================
--- gnunet/src/testbed/test_testbed_api.c 2012-09-09 07:27:05 UTC (rev
23718)
+++ gnunet/src/testbed/test_testbed_api.c 2012-09-09 12:30:54 UTC (rev
23719)
@@ -204,7 +204,7 @@
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 @@
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);
}
Modified: gnunet/src/testbed/test_testbed_api_2peers.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_2peers.c 2012-09-09 07:27:05 UTC
(rev 23718)
+++ gnunet/src/testbed/test_testbed_api_2peers.c 2012-09-09 12:30:54 UTC
(rev 23719)
@@ -214,8 +214,8 @@
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 @@
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);
}
Modified: gnunet/src/testbed/test_testbed_api_controllerlink.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_controllerlink.c 2012-09-09
07:27:05 UTC (rev 23718)
+++ gnunet/src/testbed/test_testbed_api_controllerlink.c 2012-09-09
12:30:54 UTC (rev 23719)
@@ -240,11 +240,11 @@
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 @@
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 @@
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:
Modified: gnunet/src/testbed/test_testbed_api_testbed_run.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_testbed_run.c 2012-09-09 07:27:05 UTC
(rev 23718)
+++ gnunet/src/testbed/test_testbed_api_testbed_run.c 2012-09-09 12:30:54 UTC
(rev 23719)
@@ -101,7 +101,7 @@
{
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);
}
Modified: gnunet/src/testbed/testbed_api_peers.c
===================================================================
--- gnunet/src/testbed/testbed_api_peers.c 2012-09-09 07:27:05 UTC (rev
23718)
+++ gnunet/src/testbed/testbed_api_peers.c 2012-09-09 12:30:54 UTC (rev
23719)
@@ -483,13 +483,18 @@
* 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 @@
* 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;
Modified: gnunet/src/testbed/testbed_api_testbed.c
===================================================================
--- gnunet/src/testbed/testbed_api_testbed.c 2012-09-09 07:27:05 UTC (rev
23718)
+++ gnunet/src/testbed/testbed_api_testbed.c 2012-09-09 12:30:54 UTC (rev
23719)
@@ -199,7 +199,7 @@
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 @@
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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23719 - in gnunet/src: include testbed,
gnunet <=