From: xrs Date: Sun, 21 Jan 2018 12:04:55 +0000 (+0100) Subject: update test_psyc_api_join X-Git-Tag: v0.11.0pre66~247 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1273c7df7d544cad2ab5202393aaf3b8e26e3ab1;p=oweals%2Fgnunet.git update test_psyc_api_join --- diff --git a/src/psyc/test_psyc.conf b/src/psyc/test_psyc.conf index e00a614d2..836255163 100644 --- a/src/psyc/test_psyc.conf +++ b/src/psyc/test_psyc.conf @@ -1,16 +1,28 @@ @INLINE@ ../../contrib/no_forcestart.conf -[PATHS] -GNUNET_TEST_HOME = /tmp/gnunet-test-psyc/ +[testbed] +HOSTNAME = localhost +OVERLAY_TOPOLOGY = STAR -[transport] -PLUGINS = tcp +[peerinfo] +# Option to disable all disk IO; only useful for testbed runs +# (large-scale experiments); disables persistence of HELLOs! +NO_IO = YES + +[cadet] +ID_ANNOUNCE_TIME = 5 s [nat] -DISABLEV6 = YES ENABLE_UPNP = NO -BEHIND_NAT = NO -ALLOW_NAT = NO -INTERNAL_ADDRESS = 127.0.0.1 -EXTERNAL_ADDRESS = 127.0.0.1 +[psyc] +FORCESTART = YES +AUTOSTART = YES + +[multicast] +FORCESTART = YES +AUTOSTART = YES + +[psycstore] +FORCESTART = YES +AUTOSTART = YES diff --git a/src/psyc/test_psyc_api_join.c b/src/psyc/test_psyc_api_join.c index 690c94aea..ae019d42e 100644 --- a/src/psyc/test_psyc_api_join.c +++ b/src/psyc/test_psyc_api_join.c @@ -24,6 +24,14 @@ * @author xrs */ +/** + * Lessons Learned: + * - define topology in config + * - psyc slave join needs part to end (same with master) + * - GNUNET_SCHEDULER_add_delayed return value will outdate at call time + * - main can not contain GNUNET_log() + */ + #include "platform.h" #include "gnunet_crypto_lib.h" #include "gnunet_common.h" @@ -37,17 +45,6 @@ static struct pctx PEERS[2]; static int pids; -static void -mst_stop_cb () -{ - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "master stopped\n"); -} - -static void -slv_part_cb () -{ - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "slave parted\n"); -} static void shutdown_task (void *cls) @@ -61,10 +58,12 @@ shutdown_task (void *cls) GNUNET_free (PEERS[i].channel_pub_key); if (NULL != PEERS[i].psyc) + { if (0 == i) - GNUNET_PSYC_master_stop (PEERS[i].psyc, GNUNET_NO, mst_stop_cb, NULL); + GNUNET_PSYC_master_stop (PEERS[i].psyc, GNUNET_NO, NULL, NULL); else - GNUNET_PSYC_slave_part (PEERS[i].psyc, GNUNET_NO, slv_part_cb, NULL); + GNUNET_PSYC_slave_part (PEERS[i].psyc, GNUNET_NO, NULL, NULL); + } } for (int i=0;ichannel_key, GNUNET_PSYC_CHANNEL_PRIVATE, - mst_connect_cb, + NULL, join_request_cb, - message_cb, - message_part_cb, + NULL, + NULL, cls); return peer->psyc; } @@ -163,8 +151,6 @@ psyc_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) struct GNUNET_PSYC_Message * join_msg = GNUNET_PSYC_message_create ("_request_join", env, "some data", 40); - // THOUGHT: It's possible, that psyc slave is to fast and can not connect - // to master! ask tg and grothoff about message queueing peer->psyc = (struct GNUNET_PSYC_Slave *) GNUNET_PSYC_slave_join (cfg, peer->channel_pub_key, @@ -173,9 +159,9 @@ psyc_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) peer->peer_id_master, 0, NULL, - message_cb, - message_part_cb, - slv_connect_cb, + NULL, + NULL, + NULL, join_decision_cb, cls, join_msg); @@ -245,10 +231,11 @@ testbed_master (void *cls, // Set up shutdown logic GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); timeout_task_id = - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10), + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 15), &timeout_task, NULL); GNUNET_assert (NULL != timeout_task_id); + // Set up channel key channel_key = GNUNET_CRYPTO_eddsa_key_create (); GNUNET_assert (NULL != channel_key); @@ -282,7 +269,7 @@ main (int argc, char *argv[]) { int ret; - ret = GNUNET_TESTBED_test_run ("test-psyc-api-join", "test_psyc.conf", + ret = GNUNET_TESTBED_test_run ("test_psyc_api_join", "test_psyc.conf", 2, 0LL, NULL, NULL, &testbed_master, NULL);