From 1a542d67de29d6ed40706ca70988f79bfd00fb38 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Wed, 28 Jul 2021 15:52:48 +0200 Subject: - simple test without sending. peers setup working. --- src/testbed/Makefile.am | 2 + src/testbed/gnunet-cmds-helper.c | 2 +- src/testbed/testbed_api.h | 2 +- src/testbed/testbed_api_cmd_local_test_finished.c | 2 + .../testbed_api_cmd_netjail_start_testbed.c | 13 ++++-- src/transport/Makefile.am | 24 +++++----- src/transport/transport_api_cmd_connecting_peers.c | 3 ++ src/transport/transport_api_cmd_start_peer.c | 51 ++++++++++++++++++---- 8 files changed, 73 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index c1d89607c..347d16007 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am @@ -102,6 +102,8 @@ gnunet_cmds_helper_SOURCES = \ gnunet_cmds_helper_LDADD = $(XLIB) \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testing/libgnunettesting.la \ + $(top_builddir)/src/transport/libgnunettransporttesting2.la \ + libgnunettestbed.la \ $(LTLIBINTL) $(Z_LIBS) gnunet_daemon_testbed_blacklist_SOURCES = gnunet-daemon-testbed-blacklist.c diff --git a/src/testbed/gnunet-cmds-helper.c b/src/testbed/gnunet-cmds-helper.c index 113e3c386..c4a3e98d9 100644 --- a/src/testbed/gnunet-cmds-helper.c +++ b/src/testbed/gnunet-cmds-helper.c @@ -411,7 +411,7 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) plugin = GNUNET_new (struct Plugin); plugin->api = GNUNET_PLUGIN_load (plugin_name, NULL); - plugin->library_name = GNUNET_strdup (plugin_name); + plugin->library_name = GNUNET_strdup (basename(plugin_name)); plugin->global_n = ni->global_n; plugin->local_m = ni->local_m; diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h index 9a54ca36c..67aa6dc1c 100644 --- a/src/testbed/testbed_api.h +++ b/src/testbed/testbed_api.h @@ -40,7 +40,7 @@ /** * Cmds Helper binary name */ -#define HELPER_CMDS_BINARY "gnunet-cmds-helper" +#define HELPER_CMDS_BINARY "./../testbed/gnunet-cmds-helper" /** diff --git a/src/testbed/testbed_api_cmd_local_test_finished.c b/src/testbed/testbed_api_cmd_local_test_finished.c index 8829f1b9a..b5f4b8b31 100644 --- a/src/testbed/testbed_api_cmd_local_test_finished.c +++ b/src/testbed/testbed_api_cmd_local_test_finished.c @@ -93,6 +93,8 @@ local_test_finished_finish (void *cls, void *cont_cls) { // This will stop the local loop without shutting down the scheduler, because we do not call the continuation, which is the interpreter_next method. + LOG (GNUNET_ERROR_TYPE_ERROR, + "Stopping local loop\n"); return GNUNET_YES; } diff --git a/src/testbed/testbed_api_cmd_netjail_start_testbed.c b/src/testbed/testbed_api_cmd_netjail_start_testbed.c index 67f0ef55c..de3926696 100644 --- a/src/testbed/testbed_api_cmd_netjail_start_testbed.c +++ b/src/testbed/testbed_api_cmd_netjail_start_testbed.c @@ -328,8 +328,7 @@ start_testbed (struct NetJailState *ns, struct char *const script_argv[] = {NETJAIL_EXEC_SCRIPT, m_char, n_char, - GNUNET_OS_get_libexec_binary_path ( - HELPER_CMDS_BINARY), + HELPER_CMDS_BINARY, ns->global_n, ns->local_m, NULL}; @@ -373,6 +372,9 @@ start_testbed (struct NetJailState *ns, struct &exp_cb, tbc)); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "First using helper %d\n", + tbc->count - 1); struct GNUNET_HELPER_Handle *helper = ns->helper[tbc->count - 1]; msg = create_helper_init_msg_ (m_char, @@ -469,7 +471,12 @@ netjail_start_finish (void *cls, tbc = GNUNET_new (struct TestbedCount); tbc->ns = ns; // TODO This needs to be more generic. As we send more messages back and forth, we can not grow the arrays again and again, because this is to error prone. - tbc->count = (j - 1) * atoi (ns->local_m) + i + total_number; + tbc->count = (i - 1) * atoi (ns->local_m) + j + total_number; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Second using helper %d %d %d\n", + tbc->count - 1 - total_number, + i, + j); helper = ns->helper[tbc->count - 1 - total_number]; msg_length = sizeof(struct GNUNET_CMDS_ALL_PEERS_STARTED); reply = GNUNET_new (struct GNUNET_CMDS_ALL_PEERS_STARTED); diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 3d8fa7774..2d3615e6a 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -397,18 +397,18 @@ plugin_LTLIBRARIES = \ $(HTTP_SERVER_PLUGIN_LA) \ $(HTTPS_SERVER_PLUGIN_LA) \ $(WLAN_PLUGIN_LA) \ - $(BT_PLUGIN_LA) -# libgnunet_plugin_cmd_simple_send.la - -#libgnunet_plugin_cmd_simple_send_la_SOURCES = \ -# plugin_cmd_simple_send.c -#libgnunet_plugin_cmd_simple_send_la_LIBADD = \ -# $(top_builddir)/src/util/libgnunetutil.la \ -# $(top_builddir)/src/testing/libgnunettesting.la \ -# $(top_builddir)/src/statistics/libgnunetstatistics.la \ -# $(top_builddir)/src/testbed/libgnunettestbed.la \ -# libgnunettransporttesting2.la \ -# $(LTLIBINTL) + $(BT_PLUGIN_LA) \ + libgnunet_plugin_cmd_simple_send.la + +libgnunet_plugin_cmd_simple_send_la_SOURCES = \ + plugin_cmd_simple_send.c +libgnunet_plugin_cmd_simple_send_la_LIBADD = \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ + $(top_builddir)/src/testbed/libgnunettestbed.la \ + libgnunettransporttesting2.la \ + $(LTLIBINTL) #libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ # $(GN_PLUGIN_LDFLAGS) diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c index 0f2154c46..d9253b6d4 100644 --- a/src/transport/transport_api_cmd_connecting_peers.c +++ b/src/transport/transport_api_cmd_connecting_peers.c @@ -124,6 +124,9 @@ connect_peers_finish (void *cls, } return ret;*/ + cont (cont_cls); + LOG (GNUNET_ERROR_TYPE_ERROR, + "connect peer finish\n"); return GNUNET_OK; } diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c index c9af497ae..c2cc20a2a 100644 --- a/src/transport/transport_api_cmd_start_peer.c +++ b/src/transport/transport_api_cmd_start_peer.c @@ -54,7 +54,7 @@ struct StartPeerState /** * Peer identity */ - struct GNUNET_PeerIdentity *id; + struct GNUNET_PeerIdentity id; /** * Peer's transport service handle @@ -145,7 +145,7 @@ retrieve_hello (void *cls) sps->rh_task = NULL; sps->pic = GNUNET_PEERSTORE_iterate (sps->ph, "transport", - sps->id, + &sps->id, GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY, hello_iter_cb, sps); @@ -179,7 +179,7 @@ notify_disconnect (void *cls, "Peer %s disconnected from peer %u (`%s')\n", GNUNET_i2s (peer), sps->no, - GNUNET_i2s (sps->id)); + GNUNET_i2s (&sps->id)); } @@ -199,7 +199,7 @@ notify_connect (void *cls, "Peer %s connected to peer %u (`%s')\n", GNUNET_i2s (peer), sps->no, - GNUNET_i2s (sps->id)); + GNUNET_i2s (&sps->id)); GNUNET_CONTAINER_multipeermap_put (sps->connected_peers_map, peer, @@ -222,6 +222,9 @@ start_peer_run (void *cls, const struct GNUNET_TESTING_Command *system_cmd; struct GNUNET_TESTING_System *tl_system; + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 1\n"); + if (GNUNET_NO == GNUNET_DISK_file_test (sps->cfgname)) { LOG (GNUNET_ERROR_TYPE_ERROR, @@ -251,8 +254,11 @@ start_peer_run (void *cls, sps->cfgname); GNUNET_CONFIGURATION_destroy (sps->cfg); GNUNET_TESTING_interpreter_fail (); + return; } + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 2\n"); sps->peer = GNUNET_TESTING_peer_configure (sps->tl_system, sps->cfg, sps->no, @@ -266,8 +272,11 @@ start_peer_run (void *cls, emsg); GNUNET_free (emsg); GNUNET_TESTING_interpreter_fail (); + return; } + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 3\n"); if (GNUNET_OK != GNUNET_TESTING_peer_start (sps->peer)) { LOG (GNUNET_ERROR_TYPE_ERROR, @@ -275,13 +284,19 @@ start_peer_run (void *cls, sps->cfgname); GNUNET_free (emsg); GNUNET_TESTING_interpreter_fail (); + return; } - +LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 4\n"); memset (&dummy, '\0', sizeof(dummy)); + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 4.1\n"); GNUNET_TESTING_peer_get_identity (sps->peer, - sps->id); + &sps->id); + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 4.2\n"); if (0 == memcmp (&dummy, &sps->id, sizeof(struct GNUNET_PeerIdentity))) @@ -291,11 +306,14 @@ start_peer_run (void *cls, sps->no); GNUNET_free (emsg); GNUNET_TESTING_interpreter_fail (); + return; } LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer %u configured with identity `%s'\n", sps->no, - GNUNET_i2s_full (sps->id)); + GNUNET_i2s_full (&sps->id)); + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 4.3\n"); sps->th = GNUNET_TRANSPORT_core_connect (sps->cfg, NULL, sps->handlers, @@ -310,7 +328,10 @@ start_peer_run (void *cls, emsg); GNUNET_free (emsg); GNUNET_TESTING_interpreter_fail (); + return; } + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 5\n"); sps->ph = GNUNET_PEERSTORE_connect (sps->cfg); if (NULL == sps->th) { @@ -320,7 +341,10 @@ start_peer_run (void *cls, emsg); GNUNET_free (emsg); GNUNET_TESTING_interpreter_fail (); + return; } + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 6\n"); sps->ah = GNUNET_TRANSPORT_application_init (sps->cfg); if (NULL == sps->ah) { @@ -330,6 +354,7 @@ start_peer_run (void *cls, emsg); GNUNET_free (emsg); GNUNET_TESTING_interpreter_fail (); + return; } sps->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, sps); } @@ -374,7 +399,7 @@ start_peer_cleanup (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, "Testing lib failed to stop peer %u (`%s')\n", sps->no, - GNUNET_i2s (sps->id)); + GNUNET_i2s (&sps->id)); } GNUNET_TESTING_peer_destroy (sps->peer); sps->peer = NULL; @@ -402,7 +427,7 @@ start_peer_traits (void *cls, { struct StartPeerState *sps = cls; struct GNUNET_TRANSPORT_ApplicationHandle *ah = sps->ah; - struct GNUNET_PeerIdentity *id = sps->id; + struct GNUNET_PeerIdentity *id = &sps->id; struct GNUNET_CONTAINER_MultiPeerMap *connected_peers_map = sps->connected_peers_map; char *hello = sps->hello; @@ -528,6 +553,9 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, GNUNET_CONTAINER_multipeermap_create (1,GNUNET_NO); unsigned int i; + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 0.1\n"); + sps = GNUNET_new (struct StartPeerState); sps->m = m; sps->n = n; @@ -535,6 +563,9 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, sps->connected_peers_map = connected_peers_map; sps->cfgname = cfgname; + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 0.2\n"); + if (NULL != handlers) { for (i = 0; NULL != handlers[i].cb; i++) @@ -546,6 +577,8 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, i * sizeof(struct GNUNET_MQ_MessageHandler)); } + LOG (GNUNET_ERROR_TYPE_ERROR, + "start peer 0.3\n"); struct GNUNET_TESTING_Command cmd = { .cls = sps, .label = label, -- cgit v1.2.3