diff options
Diffstat (limited to 'src/transport/transport-testing2.c')
-rw-r--r-- | src/transport/transport-testing2.c | 51 |
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 | |||
109 | struct GNUNET_OS_Process *nat_proc; | 109 | struct GNUNET_OS_Process *nat_proc; |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * resolver service process | ||
113 | */ | ||
114 | struct GNUNET_OS_Process *resolver_proc; | ||
115 | |||
116 | /** | ||
112 | * @brief Task that will be run on shutdown to stop and clean communicator | 117 | * @brief Task that will be run on shutdown to stop and clean communicator |
113 | */ | 118 | */ |
114 | struct GNUNET_SCHEDULER_Task *c_shutdown_task; | 119 | struct GNUNET_SCHEDULER_Task *c_shutdown_task; |
@@ -877,11 +882,11 @@ shutdown_process (struct GNUNET_OS_Process *proc) | |||
877 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) | 882 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) |
878 | { | 883 | { |
879 | LOG (GNUNET_ERROR_TYPE_WARNING, | 884 | LOG (GNUNET_ERROR_TYPE_WARNING, |
880 | "Error shutting down communicator with SIGERM, trying SIGKILL\n"); | 885 | "Error shutting down process with SIGERM, trying SIGKILL\n"); |
881 | if (0 != GNUNET_OS_process_kill (proc, SIGKILL)) | 886 | if (0 != GNUNET_OS_process_kill (proc, SIGKILL)) |
882 | { | 887 | { |
883 | LOG (GNUNET_ERROR_TYPE_ERROR, | 888 | LOG (GNUNET_ERROR_TYPE_ERROR, |
884 | "Error shutting down communicator with SIGERM and SIGKILL\n"); | 889 | "Error shutting down process with SIGERM and SIGKILL\n"); |
885 | } | 890 | } |
886 | } | 891 | } |
887 | GNUNET_OS_process_destroy (proc); | 892 | GNUNET_OS_process_destroy (proc); |
@@ -942,6 +947,45 @@ shutdown_nat (void *cls) | |||
942 | shutdown_process (proc); | 947 | shutdown_process (proc); |
943 | } | 948 | } |
944 | 949 | ||
950 | /** | ||
951 | * @brief Task run at shutdown to kill the resolver process | ||
952 | * | ||
953 | * @param cls Closure - Process of communicator | ||
954 | */ | ||
955 | static void | ||
956 | shutdown_resolver (void *cls) | ||
957 | { | ||
958 | struct GNUNET_OS_Process *proc = cls; | ||
959 | shutdown_process (proc); | ||
960 | } | ||
961 | |||
962 | static void | ||
963 | resolver_start (struct | ||
964 | GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h) | ||
965 | { | ||
966 | char *binary; | ||
967 | |||
968 | LOG (GNUNET_ERROR_TYPE_DEBUG, "resolver_start\n"); | ||
969 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); | ||
970 | tc_h->resolver_proc = GNUNET_OS_start_process (GNUNET_YES, | ||
971 | GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | ||
972 | NULL, | ||
973 | NULL, | ||
974 | NULL, | ||
975 | binary, | ||
976 | "gnunet-service-resolver", | ||
977 | "-c", | ||
978 | tc_h->cfg_filename, | ||
979 | NULL); | ||
980 | if (NULL == tc_h->resolver_proc) | ||
981 | { | ||
982 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start resolver service!"); | ||
983 | return; | ||
984 | } | ||
985 | LOG (GNUNET_ERROR_TYPE_INFO, "started resolver service\n"); | ||
986 | GNUNET_free (binary); | ||
987 | |||
988 | } | ||
945 | 989 | ||
946 | /** | 990 | /** |
947 | * @brief Start NAT | 991 | * @brief Start NAT |
@@ -1037,6 +1081,8 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_start ( | |||
1037 | transport_communicator_start (tc_h); | 1081 | transport_communicator_start (tc_h); |
1038 | /* Start NAT */ | 1082 | /* Start NAT */ |
1039 | nat_start (tc_h); | 1083 | nat_start (tc_h); |
1084 | /* Start resolver service */ | ||
1085 | resolver_start (tc_h); | ||
1040 | /* Schedule start communicator */ | 1086 | /* Schedule start communicator */ |
1041 | communicator_start (tc_h, | 1087 | communicator_start (tc_h, |
1042 | binary_name); | 1088 | binary_name); |
@@ -1051,6 +1097,7 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop ( | |||
1051 | shutdown_communicator (tc_h->c_proc); | 1097 | shutdown_communicator (tc_h->c_proc); |
1052 | shutdown_service (tc_h->sh); | 1098 | shutdown_service (tc_h->sh); |
1053 | shutdown_nat (tc_h->nat_proc); | 1099 | shutdown_nat (tc_h->nat_proc); |
1100 | shutdown_resolver (tc_h->resolver_proc); | ||
1054 | GNUNET_CONFIGURATION_destroy (tc_h->cfg); | 1101 | GNUNET_CONFIGURATION_destroy (tc_h->cfg); |
1055 | GNUNET_free (tc_h); | 1102 | GNUNET_free (tc_h); |
1056 | } | 1103 | } |