From 726ac3ef2819e41aa5f045d76d9966b078934e32 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Fri, 12 Jun 2020 12:51:46 +0200 Subject: Fixed 5528: TCP *communicator* bindto option should support DNS names, and 6013: TCP communicator should bind to IPv6 and IPv4 if only port given --- src/transport/transport-testing2.c | 51 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'src/transport/transport-testing2.c') diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c index e85e46b11..0dc1bb331 100644 --- a/src/transport/transport-testing2.c +++ b/src/transport/transport-testing2.c @@ -108,6 +108,11 @@ struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle */ struct GNUNET_OS_Process *nat_proc; + /** + * resolver service process + */ + struct GNUNET_OS_Process *resolver_proc; + /** * @brief Task that will be run on shutdown to stop and clean communicator */ @@ -877,11 +882,11 @@ shutdown_process (struct GNUNET_OS_Process *proc) if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) { LOG (GNUNET_ERROR_TYPE_WARNING, - "Error shutting down communicator with SIGERM, trying SIGKILL\n"); + "Error shutting down process with SIGERM, trying SIGKILL\n"); if (0 != GNUNET_OS_process_kill (proc, SIGKILL)) { LOG (GNUNET_ERROR_TYPE_ERROR, - "Error shutting down communicator with SIGERM and SIGKILL\n"); + "Error shutting down process with SIGERM and SIGKILL\n"); } } GNUNET_OS_process_destroy (proc); @@ -942,6 +947,45 @@ shutdown_nat (void *cls) shutdown_process (proc); } +/** + * @brief Task run at shutdown to kill the resolver process + * + * @param cls Closure - Process of communicator + */ +static void +shutdown_resolver (void *cls) +{ + struct GNUNET_OS_Process *proc = cls; + shutdown_process (proc); +} + +static void +resolver_start (struct + GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h) +{ + char *binary; + + LOG (GNUNET_ERROR_TYPE_DEBUG, "resolver_start\n"); + binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); + tc_h->resolver_proc = GNUNET_OS_start_process (GNUNET_YES, + GNUNET_OS_INHERIT_STD_OUT_AND_ERR, + NULL, + NULL, + NULL, + binary, + "gnunet-service-resolver", + "-c", + tc_h->cfg_filename, + NULL); + if (NULL == tc_h->resolver_proc) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start resolver service!"); + return; + } + LOG (GNUNET_ERROR_TYPE_INFO, "started resolver service\n"); + GNUNET_free (binary); + +} /** * @brief Start NAT @@ -1037,6 +1081,8 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_start ( transport_communicator_start (tc_h); /* Start NAT */ nat_start (tc_h); + /* Start resolver service */ + resolver_start (tc_h); /* Schedule start communicator */ communicator_start (tc_h, binary_name); @@ -1051,6 +1097,7 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop ( shutdown_communicator (tc_h->c_proc); shutdown_service (tc_h->sh); shutdown_nat (tc_h->nat_proc); + shutdown_resolver (tc_h->resolver_proc); GNUNET_CONFIGURATION_destroy (tc_h->cfg); GNUNET_free (tc_h); } -- cgit v1.2.3