summaryrefslogtreecommitdiff
path: root/src/transport/transport-testing2.c
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2020-06-12 12:51:46 +0200
committert3sserakt <t3ss@posteo.de>2020-06-12 12:51:46 +0200
commit726ac3ef2819e41aa5f045d76d9966b078934e32 (patch)
treebb94685c92fd06acfd1e9e2866b2afdffe1ec477 /src/transport/transport-testing2.c
parent11dbdc79aeb05e82913ac70cf2ac8d4f45b02c28 (diff)
Fixed 5528: TCP *communicator* bindto option should support DNS names, and 6013: TCP communicator should bind to IPv6 and IPv4 if only port given
Diffstat (limited to 'src/transport/transport-testing2.c')
-rw-r--r--src/transport/transport-testing2.c51
1 files changed, 49 insertions, 2 deletions
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
@@ -109,6 +109,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
*/
struct GNUNET_SCHEDULER_Task *c_shutdown_task;
@@ -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);
}