diff options
Diffstat (limited to 'src/transport/transport-testing2.c')
-rw-r--r-- | src/transport/transport-testing2.c | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c index 0dc1bb331..974dc56c1 100644 --- a/src/transport/transport-testing2.c +++ b/src/transport/transport-testing2.c | |||
@@ -114,6 +114,11 @@ struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle | |||
114 | struct GNUNET_OS_Process *resolver_proc; | 114 | struct GNUNET_OS_Process *resolver_proc; |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * peerstore service process | ||
118 | */ | ||
119 | struct GNUNET_OS_Process *ps_proc; | ||
120 | |||
121 | /** | ||
117 | * @brief Task that will be run on shutdown to stop and clean communicator | 122 | * @brief Task that will be run on shutdown to stop and clean communicator |
118 | */ | 123 | */ |
119 | struct GNUNET_SCHEDULER_Task *c_shutdown_task; | 124 | struct GNUNET_SCHEDULER_Task *c_shutdown_task; |
@@ -671,8 +676,8 @@ handle_update_queue_message (void *cls, | |||
671 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue; | 676 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue; |
672 | 677 | ||
673 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 678 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
674 | "Received queue update message for %u with q_len %"PRIu64"\n", | 679 | "Received queue update message for %u with q_len %" PRIu64 "\n", |
675 | msg->qid, GNUNET_ntohll(msg->q_len)); | 680 | msg->qid, GNUNET_ntohll (msg->q_len)); |
676 | tc_queue = tc_h->queue_head; | 681 | tc_queue = tc_h->queue_head; |
677 | if (NULL != tc_queue) | 682 | if (NULL != tc_queue) |
678 | { | 683 | { |
@@ -892,6 +897,12 @@ shutdown_process (struct GNUNET_OS_Process *proc) | |||
892 | GNUNET_OS_process_destroy (proc); | 897 | GNUNET_OS_process_destroy (proc); |
893 | } | 898 | } |
894 | 899 | ||
900 | static void | ||
901 | shutdown_peerstore (void *cls) | ||
902 | { | ||
903 | struct GNUNET_OS_Process *proc = cls; | ||
904 | shutdown_process (proc); | ||
905 | } | ||
895 | 906 | ||
896 | static void | 907 | static void |
897 | shutdown_communicator (void *cls) | 908 | shutdown_communicator (void *cls) |
@@ -987,6 +998,38 @@ resolver_start (struct | |||
987 | 998 | ||
988 | } | 999 | } |
989 | 1000 | ||
1001 | |||
1002 | /** | ||
1003 | * @brief Start Peerstore | ||
1004 | * | ||
1005 | */ | ||
1006 | static void | ||
1007 | peerstore_start ( | ||
1008 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h) | ||
1009 | { | ||
1010 | char *binary; | ||
1011 | |||
1012 | LOG (GNUNET_ERROR_TYPE_DEBUG, "peerstore_start\n"); | ||
1013 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-peerstore"); | ||
1014 | tc_h->ps_proc = GNUNET_OS_start_process (GNUNET_YES, | ||
1015 | GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | ||
1016 | NULL, | ||
1017 | NULL, | ||
1018 | NULL, | ||
1019 | binary, | ||
1020 | "gnunet-service-peerstore", | ||
1021 | "-c", | ||
1022 | tc_h->cfg_filename, | ||
1023 | NULL); | ||
1024 | if (NULL == tc_h->ps_proc) | ||
1025 | { | ||
1026 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start Peerstore!"); | ||
1027 | return; | ||
1028 | } | ||
1029 | LOG (GNUNET_ERROR_TYPE_INFO, "started Peerstore\n"); | ||
1030 | GNUNET_free (binary); | ||
1031 | } | ||
1032 | |||
990 | /** | 1033 | /** |
991 | * @brief Start NAT | 1034 | * @brief Start NAT |
992 | * | 1035 | * |
@@ -1018,7 +1061,6 @@ nat_start ( | |||
1018 | GNUNET_free (binary); | 1061 | GNUNET_free (binary); |
1019 | } | 1062 | } |
1020 | 1063 | ||
1021 | |||
1022 | /** | 1064 | /** |
1023 | * @brief Start communicator part of transport service and communicator | 1065 | * @brief Start communicator part of transport service and communicator |
1024 | * | 1066 | * |
@@ -1083,6 +1125,8 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_start ( | |||
1083 | nat_start (tc_h); | 1125 | nat_start (tc_h); |
1084 | /* Start resolver service */ | 1126 | /* Start resolver service */ |
1085 | resolver_start (tc_h); | 1127 | resolver_start (tc_h); |
1128 | /* Start peerstore service */ | ||
1129 | peerstore_start (tc_h); | ||
1086 | /* Schedule start communicator */ | 1130 | /* Schedule start communicator */ |
1087 | communicator_start (tc_h, | 1131 | communicator_start (tc_h, |
1088 | binary_name); | 1132 | binary_name); |
@@ -1098,6 +1142,7 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop ( | |||
1098 | shutdown_service (tc_h->sh); | 1142 | shutdown_service (tc_h->sh); |
1099 | shutdown_nat (tc_h->nat_proc); | 1143 | shutdown_nat (tc_h->nat_proc); |
1100 | shutdown_resolver (tc_h->resolver_proc); | 1144 | shutdown_resolver (tc_h->resolver_proc); |
1145 | shutdown_peerstore (tc_h->ps_proc); | ||
1101 | GNUNET_CONFIGURATION_destroy (tc_h->cfg); | 1146 | GNUNET_CONFIGURATION_destroy (tc_h->cfg); |
1102 | GNUNET_free (tc_h); | 1147 | GNUNET_free (tc_h); |
1103 | } | 1148 | } |