aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport-testing-communicator.c
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2020-12-14 11:18:18 +0100
committert3sserakt <t3ss@posteo.de>2020-12-14 11:18:18 +0100
commit561596641606ecc0b5f71658c34eab1312ad8f18 (patch)
treeab6885a86b2c47fd7789ed791f46300c5086b55f /src/transport/transport-testing-communicator.c
parent11d9dc39621d6b0450211ce501acbfef49c7ca02 (diff)
downloadgnunet-561596641606ecc0b5f71658c34eab1312ad8f18.tar.gz
gnunet-561596641606ecc0b5f71658c34eab1312ad8f18.zip
- added code again that was accidentally lost during merge
Diffstat (limited to 'src/transport/transport-testing-communicator.c')
-rw-r--r--src/transport/transport-testing-communicator.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/transport/transport-testing-communicator.c b/src/transport/transport-testing-communicator.c
index 6d74b12e8..56240864c 100644
--- a/src/transport/transport-testing-communicator.c
+++ b/src/transport/transport-testing-communicator.c
@@ -766,6 +766,23 @@ shutdown_process (struct GNUNET_OS_Process *proc)
766 GNUNET_OS_process_destroy (proc); 766 GNUNET_OS_process_destroy (proc);
767} 767}
768 768
769/**
770 * @brief Task run at shutdown to kill the statistics process
771 *
772 * @param cls Closure - Process of communicator
773 */
774static void
775shutdown_statistics (void *cls)
776{
777 struct GNUNET_OS_Process *proc = cls;
778 shutdown_process (proc);
779}
780
781/**
782 * @brief Task run at shutdown to kill the peerstore process
783 *
784 * @param cls Closure - Process of communicator
785 */
769static void 786static void
770shutdown_peerstore (void *cls) 787shutdown_peerstore (void *cls)
771{ 788{
@@ -773,6 +790,11 @@ shutdown_peerstore (void *cls)
773 shutdown_process (proc); 790 shutdown_process (proc);
774} 791}
775 792
793/**
794 * @brief Task run at shutdown to kill a communicator process
795 *
796 * @param cls Closure - Process of communicator
797 */
776static void 798static void
777shutdown_communicator (void *cls) 799shutdown_communicator (void *cls)
778{ 800{
@@ -852,6 +874,10 @@ shutdown_resolver (void *cls)
852} 874}
853 875
854 876
877/**
878 * @brief Start Resolver
879 *
880 */
855static void 881static void
856resolver_start (struct 882resolver_start (struct
857 GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h) 883 GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h)
@@ -881,6 +907,34 @@ resolver_start (struct
881 907
882} 908}
883 909
910/**
911 * @brief Start Statistics
912 *
913 */
914static void
915statistics_start (
916 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h)
917{
918 char *binary;
919
920 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics");
921 tc_h->stat_proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
922 NULL,
923 NULL,
924 NULL,
925 binary,
926 "gnunet-service-statistics",
927 "-c",
928 tc_h->cfg_filename,
929 NULL);
930 if (NULL == tc_h->stat_proc)
931 {
932 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start Statistics!");
933 return;
934 }
935 LOG (GNUNET_ERROR_TYPE_INFO, "started Statistics\n");
936 GNUNET_free (binary);
937}
884 938
885/** 939/**
886 * @brief Start Peerstore 940 * @brief Start Peerstore
@@ -1009,6 +1063,8 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
1009 resolver_start (tc_h); 1063 resolver_start (tc_h);
1010 /* Start peerstore service */ 1064 /* Start peerstore service */
1011 peerstore_start (tc_h); 1065 peerstore_start (tc_h);
1066 /* Start statistic service */
1067 statistics_start (tc_h);
1012 /* Schedule start communicator */ 1068 /* Schedule start communicator */
1013 communicator_start (tc_h, 1069 communicator_start (tc_h,
1014 binary_name); 1070 binary_name);
@@ -1025,6 +1081,7 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop (
1025 shutdown_nat (tc_h->nat_proc); 1081 shutdown_nat (tc_h->nat_proc);
1026 shutdown_resolver (tc_h->resolver_proc); 1082 shutdown_resolver (tc_h->resolver_proc);
1027 shutdown_peerstore (tc_h->ps_proc); 1083 shutdown_peerstore (tc_h->ps_proc);
1084 shutdown_statistics (tc_h->stat_proc);
1028 GNUNET_CONFIGURATION_destroy (tc_h->cfg); 1085 GNUNET_CONFIGURATION_destroy (tc_h->cfg);
1029 GNUNET_free (tc_h); 1086 GNUNET_free (tc_h);
1030} 1087}