diff options
Diffstat (limited to 'src/transport/transport-testing2.c')
-rw-r--r-- | src/transport/transport-testing2.c | 154 |
1 files changed, 7 insertions, 147 deletions
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c index 13944e9f0..98cfd5e29 100644 --- a/src/transport/transport-testing2.c +++ b/src/transport/transport-testing2.c | |||
@@ -59,145 +59,6 @@ struct MyClient | |||
59 | }; | 59 | }; |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * @brief Handle to a transport communicator | ||
63 | */ | ||
64 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle | ||
65 | { | ||
66 | /** | ||
67 | * Clients | ||
68 | */ | ||
69 | struct MyClient *client_head; | ||
70 | struct MyClient *client_tail; | ||
71 | |||
72 | /** | ||
73 | * @brief Handle to the client | ||
74 | */ | ||
75 | struct GNUNET_MQ_Handle *c_mq; | ||
76 | |||
77 | /** | ||
78 | * @brief Handle to the configuration | ||
79 | */ | ||
80 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
81 | |||
82 | /** | ||
83 | * @brief File name of configuration file | ||
84 | */ | ||
85 | char *cfg_filename; | ||
86 | |||
87 | struct GNUNET_PeerIdentity peer_id; | ||
88 | |||
89 | /** | ||
90 | * @brief Handle to the transport service | ||
91 | */ | ||
92 | struct GNUNET_SERVICE_Handle *tsh; | ||
93 | |||
94 | /** | ||
95 | * @brief Task that will be run on shutdown to stop and clean transport | ||
96 | * service | ||
97 | */ | ||
98 | struct GNUNET_SCHEDULER_Task *ts_shutdown_task; | ||
99 | |||
100 | |||
101 | /** | ||
102 | * @brief Process of the communicator | ||
103 | */ | ||
104 | struct GNUNET_OS_Process *c_proc; | ||
105 | |||
106 | /** | ||
107 | * NAT process | ||
108 | */ | ||
109 | struct GNUNET_OS_Process *nat_proc; | ||
110 | |||
111 | /** | ||
112 | * resolver service process | ||
113 | */ | ||
114 | struct GNUNET_OS_Process *resolver_proc; | ||
115 | |||
116 | /** | ||
117 | * peerstore service process | ||
118 | */ | ||
119 | struct GNUNET_OS_Process *ps_proc; | ||
120 | |||
121 | /** | ||
122 | * @brief Task that will be run on shutdown to stop and clean communicator | ||
123 | */ | ||
124 | struct GNUNET_SCHEDULER_Task *c_shutdown_task; | ||
125 | |||
126 | /** | ||
127 | * @brief Characteristics of the communicator | ||
128 | */ | ||
129 | enum GNUNET_TRANSPORT_CommunicatorCharacteristics c_characteristics; | ||
130 | |||
131 | /** | ||
132 | * @brief Specifies supported addresses | ||
133 | */ | ||
134 | char *c_addr_prefix; | ||
135 | |||
136 | /** | ||
137 | * @brief Specifies supported addresses | ||
138 | */ | ||
139 | char *c_address; | ||
140 | |||
141 | /** | ||
142 | * @brief Head of the DLL of queues associated with this communicator | ||
143 | */ | ||
144 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *queue_head; | ||
145 | |||
146 | /** | ||
147 | * @brief Tail of the DLL of queues associated with this communicator | ||
148 | */ | ||
149 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *queue_tail; | ||
150 | |||
151 | /* Callbacks + Closures */ | ||
152 | /** | ||
153 | * @brief Callback called when a new communicator connects | ||
154 | */ | ||
155 | GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback | ||
156 | communicator_available_cb; | ||
157 | |||
158 | /** | ||
159 | * @brief Callback called when a new communicator connects | ||
160 | */ | ||
161 | GNUNET_TRANSPORT_TESTING_AddAddressCallback add_address_cb; | ||
162 | |||
163 | /** | ||
164 | * @brief Callback called when a new communicator connects | ||
165 | */ | ||
166 | GNUNET_TRANSPORT_TESTING_QueueCreateReplyCallback queue_create_reply_cb; | ||
167 | |||
168 | /** | ||
169 | * @brief Callback called when a new communicator connects | ||
170 | */ | ||
171 | GNUNET_TRANSPORT_TESTING_AddQueueCallback add_queue_cb; | ||
172 | |||
173 | /** | ||
174 | * @brief Callback called when a new communicator connects | ||
175 | */ | ||
176 | GNUNET_TRANSPORT_TESTING_IncomingMessageCallback incoming_msg_cb; | ||
177 | |||
178 | /** | ||
179 | * @brief Backchannel callback | ||
180 | */ | ||
181 | GNUNET_TRANSPORT_TESTING_BackchannelCallback bc_cb; | ||
182 | |||
183 | /** | ||
184 | * Our service handle | ||
185 | */ | ||
186 | struct GNUNET_SERVICE_Handle *sh; | ||
187 | |||
188 | /** | ||
189 | * @brief Closure to the callback | ||
190 | */ | ||
191 | void *cb_cls; | ||
192 | |||
193 | /** | ||
194 | * Backchannel supported | ||
195 | */ | ||
196 | int bc_enabled; | ||
197 | }; | ||
198 | |||
199 | |||
200 | /** | ||
201 | * @brief Queue of a communicator and some context | 62 | * @brief Queue of a communicator and some context |
202 | */ | 63 | */ |
203 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue | 64 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue |
@@ -707,6 +568,9 @@ shutdown_service (void *cls) | |||
707 | { | 568 | { |
708 | struct GNUNET_SERVICE_Handle *h = cls; | 569 | struct GNUNET_SERVICE_Handle *h = cls; |
709 | 570 | ||
571 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
572 | "Shutting down service!\n"); | ||
573 | |||
710 | GNUNET_SERVICE_stop (h); | 574 | GNUNET_SERVICE_stop (h); |
711 | } | 575 | } |
712 | 576 | ||
@@ -897,7 +761,6 @@ shutdown_process (struct GNUNET_OS_Process *proc) | |||
897 | GNUNET_OS_process_destroy (proc); | 761 | GNUNET_OS_process_destroy (proc); |
898 | } | 762 | } |
899 | 763 | ||
900 | |||
901 | static void | 764 | static void |
902 | shutdown_peerstore (void *cls) | 765 | shutdown_peerstore (void *cls) |
903 | { | 766 | { |
@@ -905,7 +768,6 @@ shutdown_peerstore (void *cls) | |||
905 | shutdown_process (proc); | 768 | shutdown_process (proc); |
906 | } | 769 | } |
907 | 770 | ||
908 | |||
909 | static void | 771 | static void |
910 | shutdown_communicator (void *cls) | 772 | shutdown_communicator (void *cls) |
911 | { | 773 | { |
@@ -941,8 +803,7 @@ communicator_start ( | |||
941 | 803 | ||
942 | 804 | ||
943 | binary = GNUNET_OS_get_libexec_binary_path (binary_name); | 805 | binary = GNUNET_OS_get_libexec_binary_path (binary_name); |
944 | tc_h->c_proc = GNUNET_OS_start_process_s (GNUNET_OS_USE_PIPE_CONTROL | 806 | tc_h->c_proc = GNUNET_OS_start_process_s (GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
945 | | GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | ||
946 | NULL, | 807 | NULL, |
947 | loprefix, | 808 | loprefix, |
948 | binary, | 809 | binary, |
@@ -1026,10 +887,8 @@ peerstore_start ( | |||
1026 | { | 887 | { |
1027 | char *binary; | 888 | char *binary; |
1028 | 889 | ||
1029 | LOG (GNUNET_ERROR_TYPE_DEBUG, "peerstore_start\n"); | ||
1030 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-peerstore"); | 890 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-peerstore"); |
1031 | tc_h->ps_proc = GNUNET_OS_start_process (GNUNET_OS_USE_PIPE_CONTROL | 891 | tc_h->ps_proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
1032 | | GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | ||
1033 | NULL, | 892 | NULL, |
1034 | NULL, | 893 | NULL, |
1035 | NULL, | 894 | NULL, |
@@ -1047,7 +906,6 @@ peerstore_start ( | |||
1047 | GNUNET_free (binary); | 906 | GNUNET_free (binary); |
1048 | } | 907 | } |
1049 | 908 | ||
1050 | |||
1051 | /** | 909 | /** |
1052 | * @brief Start NAT | 910 | * @brief Start NAT |
1053 | * | 911 | * |
@@ -1208,6 +1066,8 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue ( | |||
1208 | memcpy (&msg[1], address, alen); | 1066 | memcpy (&msg[1], address, alen); |
1209 | if (NULL != tc_h->c_mq) | 1067 | if (NULL != tc_h->c_mq) |
1210 | { | 1068 | { |
1069 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1070 | "Sending queue create immediately\n"); | ||
1211 | GNUNET_MQ_send (tc_h->c_mq, env); | 1071 | GNUNET_MQ_send (tc_h->c_mq, env); |
1212 | } | 1072 | } |
1213 | else | 1073 | else |