diff options
Diffstat (limited to 'src/transport/transport-testing-communicator.c')
-rw-r--r-- | src/transport/transport-testing-communicator.c | 57 |
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 | */ | ||
774 | static void | ||
775 | shutdown_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 | */ | ||
769 | static void | 786 | static void |
770 | shutdown_peerstore (void *cls) | 787 | shutdown_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 | */ | ||
776 | static void | 798 | static void |
777 | shutdown_communicator (void *cls) | 799 | shutdown_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 | */ | ||
855 | static void | 881 | static void |
856 | resolver_start (struct | 882 | resolver_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 | */ | ||
914 | static void | ||
915 | statistics_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 | } |