* x setup peer B
* x setup cadet on peer B listening on port "cadet_port"
* x create a channel from peer A to B
- * - create method to find out KX initiator
+ * x create method to find out KX initiator
* - send a message over channel
* - check if message was received
* - breakup the connection without sending a channel destroy message
/****************************** TEST LOGIC ********************************/
+static int kx_initiator;
+
void
run_test ()
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
+ kx_initiator = (0 < GNUNET_memcmp (&test_peers[0].id, &test_peers[1].id)) ? 1 : 0;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "KX initiator is peer %s\n",
+ GNUNET_i2s (&test_peers[kx_initiator].id));
+
/**
* This function is called after all testbed management is done and the
* testbed peers are ready for the actual test logic.
*/
static int peerinfo_cnt = 0;
-/**
- * Structure for storing information of testbed peers.
- */
-struct TEST_PEERS
-{
- /**
- * Index of the peer.
- */
- int idx;
-
- /**
- * Peer Identity.
- */
- struct GNUNET_PeerIdentity id;
-
- /**
- * Handle of TESTBED peer.
- */
- struct GNUNET_TESTBED_Peer *testbed_peer;
-
- /**
- * Testbed management is finished and test peer is ready for test logic.
- */
- int ready;
-
- /**
- * Channel of initiating peer.
- */
- struct GNUNET_CADET_Channel *channel;
-
- /**
- * CADET handle.
- */
- struct GNUNET_CADET_Handle *cadet;
-
-} test_peers[REQUESTED_PEERS];
-
/************************** TESBED MANAGEMENT *****************************/
static void
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
- // FIXME: check, if all peers are ready, then continue with the
- // test logic.
- if (GNUNET_OK)
+ if (NULL != test_peers[0].cadet && NULL != test_peers[1].cadet)
run_test();
}
void prepare_test ();
void run_test ();
+
+/**
+ * Structure for storing information of testbed peers.
+ */
+struct TEST_PEERS
+{
+ /**
+ * Index of the peer.
+ */
+ int idx;
+
+ /**
+ * Peer Identity.
+ */
+ struct GNUNET_PeerIdentity id;
+
+ /**
+ * Handle of TESTBED peer.
+ */
+ struct GNUNET_TESTBED_Peer *testbed_peer;
+
+ /**
+ * Testbed management is finished and test peer is ready for test logic.
+ */
+ int ready;
+
+ /**
+ * Channel of initiating peer.
+ */
+ struct GNUNET_CADET_Channel *channel;
+
+ /**
+ * CADET handle.
+ */
+ struct GNUNET_CADET_Handle *cadet;
+
+} test_peers[REQUESTED_PEERS];