#define REQUESTED_PEERS 2
#define CONFIG "test_cadet.conf"
#define TESTPROGAM_NAME "test-cadet-channel-resumption"
+#define TIMEOUT_IN_SEC 5
#define PORTNAME "cadet_port"
/**
*/
static int test_result = 0;
-// FIXME: temp cnt
-static int cnt = 0;
-
/**
* Counter for gathering peerinformation.
*/
*/
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[2];
static void
shutdown_task (void *cls)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
+
for (int i=0; i<REQUESTED_PEERS; i++)
GNUNET_TESTBED_operation_done (testbed_to_svc[i]);
}
+static void
+timeout ()
+{
+ GNUNET_SCHEDULER_shutdown ();
+}
+
static void
disconnect_from_peer (void *cls,
void *op_result)
}
static void
-handle_channel_destroy (void *cls,
- const struct GNUNET_CADET_Channel *channel)
+disconnect_channel (void *cls,
+ const struct GNUNET_CADET_Channel *channel)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
}
static void *
setup_initiating_peer (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
-
struct GNUNET_CADET_Handle *cadet;
- struct GNUNET_PeerIdentity *destination;
struct GNUNET_CADET_Channel *channel;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
cadet = GNUNET_CADET_connect (cfg);
+ test_peers[0].cadet = cadet;
+
+ if (NULL == cadet)
+ GNUNET_SCHEDULER_shutdown ();
channel = GNUNET_CADET_channel_create (cadet,
NULL,
- destination,
+ &test_peers[1].id,
&hashed_portname,
NULL,
- &handle_channel_destroy,
+ &disconnect_channel,
NULL);
-
- if (NULL == cadet)
- GNUNET_SCHEDULER_shutdown ();
+ test_peers[0].channel = channel;
return cadet;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
cadet = GNUNET_CADET_connect (cfg);
+ test_peers[1].cadet = cadet;
if (NULL == cadet)
GNUNET_SCHEDULER_shutdown ();
const char *emsg)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
-
- if (2 == ++cnt)
- GNUNET_SCHEDULER_shutdown ();
}
&test_peers[1]);
GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, TIMEOUT_IN_SEC),
+ &timeout, NULL);
}
int