diff options
author | t3sserakt <t3ss@posteo.de> | 2020-12-14 11:18:18 +0100 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2020-12-14 11:18:18 +0100 |
commit | 561596641606ecc0b5f71658c34eab1312ad8f18 (patch) | |
tree | ab6885a86b2c47fd7789ed791f46300c5086b55f /src | |
parent | 11d9dc39621d6b0450211ce501acbfef49c7ca02 (diff) | |
download | gnunet-561596641606ecc0b5f71658c34eab1312ad8f18.tar.gz gnunet-561596641606ecc0b5f71658c34eab1312ad8f18.zip |
- added code again that was accidentally lost during merge
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/test_communicator_basic.c | 22 | ||||
-rw-r--r-- | src/transport/transport-testing-communicator.c | 57 | ||||
-rw-r--r-- | src/transport/transport-testing-communicator.h | 5 |
3 files changed, 74 insertions, 10 deletions
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c index 21c371f3a..10c942daa 100644 --- a/src/transport/test_communicator_basic.c +++ b/src/transport/test_communicator_basic.c | |||
@@ -743,9 +743,11 @@ incoming_message_cb (void *cls, | |||
743 | &process_statistics, | 743 | &process_statistics, |
744 | NULL); | 744 | NULL); |
745 | } | 745 | } |
746 | /* LOG (GNUNET_ERROR_TYPE_DEBUG, */ | 746 | else{ |
747 | /* "Finished\n"); */ | 747 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
748 | /* GNUNET_SCHEDULER_shutdown (); */ | 748 | "Finished\n"); |
749 | GNUNET_SCHEDULER_shutdown (); | ||
750 | } | ||
749 | } | 751 | } |
750 | break; | 752 | break; |
751 | } | 753 | } |
@@ -795,13 +797,6 @@ run (void *cls) | |||
795 | // num_sent = 0; | 797 | // num_sent = 0; |
796 | for (unsigned int i = 0; i < NUM_PEERS; i++) | 798 | for (unsigned int i = 0; i < NUM_PEERS; i++) |
797 | { | 799 | { |
798 | if ((0 == strcmp ("rekey", test_name))||(0 == strcmp ("backchannel", | ||
799 | test_name)) ) | ||
800 | { | ||
801 | stats[i] = GNUNET_STATISTICS_create ("C-UDP", | ||
802 | cfg_peers[i]); | ||
803 | } | ||
804 | |||
805 | tc_hs[i] = GNUNET_TRANSPORT_TESTING_transport_communicator_service_start ( | 800 | tc_hs[i] = GNUNET_TRANSPORT_TESTING_transport_communicator_service_start ( |
806 | "transport", | 801 | "transport", |
807 | communicator_binary, | 802 | communicator_binary, |
@@ -814,6 +809,13 @@ run (void *cls) | |||
814 | &incoming_message_cb, | 809 | &incoming_message_cb, |
815 | &handle_backchannel_cb, | 810 | &handle_backchannel_cb, |
816 | cfg_peers_name[i]); /* cls */ | 811 | cfg_peers_name[i]); /* cls */ |
812 | |||
813 | if ((0 == strcmp ("rekey", test_name))||(0 == strcmp ("backchannel", | ||
814 | test_name)) ) | ||
815 | { | ||
816 | stats[i] = GNUNET_STATISTICS_create ("C-UDP", | ||
817 | cfg_peers[i]); | ||
818 | } | ||
817 | } | 819 | } |
818 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, | 820 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, |
819 | NULL); | 821 | NULL); |
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 | } |
diff --git a/src/transport/transport-testing-communicator.h b/src/transport/transport-testing-communicator.h index 693e61515..1875258b4 100644 --- a/src/transport/transport-testing-communicator.h +++ b/src/transport/transport-testing-communicator.h | |||
@@ -200,6 +200,11 @@ struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle | |||
200 | struct GNUNET_OS_Process *resolver_proc; | 200 | struct GNUNET_OS_Process *resolver_proc; |
201 | 201 | ||
202 | /** | 202 | /** |
203 | * statistics service process | ||
204 | */ | ||
205 | struct GNUNET_OS_Process *stat_proc; | ||
206 | |||
207 | /** | ||
203 | * peerstore service process | 208 | * peerstore service process |
204 | */ | 209 | */ |
205 | struct GNUNET_OS_Process *ps_proc; | 210 | struct GNUNET_OS_Process *ps_proc; |