diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
commit | c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch) | |
tree | cac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/transport/test_transport_address_switch.c | |
parent | fbb71d527c7d6babf269a8fefce1db291b9f7068 (diff) | |
download | gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip |
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/transport/test_transport_address_switch.c')
-rw-r--r-- | src/transport/test_transport_address_switch.c | 354 |
1 files changed, 178 insertions, 176 deletions
diff --git a/src/transport/test_transport_address_switch.c b/src/transport/test_transport_address_switch.c index ffb6baefe..b030aa1b8 100644 --- a/src/transport/test_transport_address_switch.c +++ b/src/transport/test_transport_address_switch.c | |||
@@ -51,7 +51,7 @@ | |||
51 | /** | 51 | /** |
52 | * Testcase timeout (set aggressively as we know this test doesn't work right now) | 52 | * Testcase timeout (set aggressively as we know this test doesn't work right now) |
53 | */ | 53 | */ |
54 | #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30) | 54 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) |
55 | 55 | ||
56 | 56 | ||
57 | static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc; | 57 | static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc; |
@@ -62,7 +62,8 @@ static struct GNUNET_SCHEDULER_Task *measure_task; | |||
62 | /** | 62 | /** |
63 | * Statistics we track per peer. | 63 | * Statistics we track per peer. |
64 | */ | 64 | */ |
65 | struct PeerStats { | 65 | struct PeerStats |
66 | { | ||
66 | struct GNUNET_STATISTICS_Handle *stat; | 67 | struct GNUNET_STATISTICS_Handle *stat; |
67 | 68 | ||
68 | unsigned int addresses_avail; | 69 | unsigned int addresses_avail; |
@@ -83,16 +84,16 @@ static unsigned long long bytes_recv_after_switch; | |||
83 | 84 | ||
84 | 85 | ||
85 | static int | 86 | static int |
86 | stat_start_attempt_cb(void *cls, | 87 | stat_start_attempt_cb (void *cls, |
87 | const char *subsystem, | 88 | const char *subsystem, |
88 | const char *name, | 89 | const char *name, |
89 | uint64_t value, | 90 | uint64_t value, |
90 | int is_persistent) | 91 | int is_persistent) |
91 | { | 92 | { |
92 | struct PeerStats *stat = cls; | 93 | struct PeerStats *stat = cls; |
93 | 94 | ||
94 | stat->switch_attempts++; | 95 | stat->switch_attempts++; |
95 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Switch attempted (%p)", stat); | 96 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Switch attempted (%p)", stat); |
96 | bytes_recv_after_switch = 0; | 97 | bytes_recv_after_switch = 0; |
97 | bytes_sent_after_switch = 0; | 98 | bytes_sent_after_switch = 0; |
98 | 99 | ||
@@ -101,26 +102,26 @@ stat_start_attempt_cb(void *cls, | |||
101 | 102 | ||
102 | 103 | ||
103 | static int | 104 | static int |
104 | stat_success_attempt_cb(void *cls, | 105 | stat_success_attempt_cb (void *cls, |
105 | const char *subsystem, | 106 | const char *subsystem, |
106 | const char *name, | 107 | const char *name, |
107 | uint64_t value, | 108 | uint64_t value, |
108 | int is_persistent) | 109 | int is_persistent) |
109 | { | 110 | { |
110 | struct PeerStats *stat = cls; | 111 | struct PeerStats *stat = cls; |
111 | 112 | ||
112 | stat->switch_success++; | 113 | stat->switch_success++; |
113 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Switch succeeded (%p)", stat); | 114 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Switch succeeded (%p)", stat); |
114 | return GNUNET_OK; | 115 | return GNUNET_OK; |
115 | } | 116 | } |
116 | 117 | ||
117 | 118 | ||
118 | static int | 119 | static int |
119 | stat_fail_attempt_cb(void *cls, | 120 | stat_fail_attempt_cb (void *cls, |
120 | const char *subsystem, | 121 | const char *subsystem, |
121 | const char *name, | 122 | const char *name, |
122 | uint64_t value, | 123 | uint64_t value, |
123 | int is_persistent) | 124 | int is_persistent) |
124 | { | 125 | { |
125 | struct PeerStats *stat = cls; | 126 | struct PeerStats *stat = cls; |
126 | 127 | ||
@@ -128,17 +129,17 @@ stat_fail_attempt_cb(void *cls, | |||
128 | return GNUNET_OK; | 129 | return GNUNET_OK; |
129 | 130 | ||
130 | stat->switch_fail++; | 131 | stat->switch_fail++; |
131 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Switch failed (%p)", stat); | 132 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Switch failed (%p)", stat); |
132 | return GNUNET_OK; | 133 | return GNUNET_OK; |
133 | } | 134 | } |
134 | 135 | ||
135 | 136 | ||
136 | static int | 137 | static int |
137 | stat_addresses_available(void *cls, | 138 | stat_addresses_available (void *cls, |
138 | const char *subsystem, | 139 | const char *subsystem, |
139 | const char *name, | 140 | const char *name, |
140 | uint64_t value, | 141 | uint64_t value, |
141 | int is_persistent) | 142 | int is_persistent) |
142 | { | 143 | { |
143 | struct PeerStats *stat = cls; | 144 | struct PeerStats *stat = cls; |
144 | 145 | ||
@@ -150,7 +151,8 @@ stat_addresses_available(void *cls, | |||
150 | /** | 151 | /** |
151 | * List of statistics entries we care about. | 152 | * List of statistics entries we care about. |
152 | */ | 153 | */ |
153 | static struct WatchEntry { | 154 | static struct WatchEntry |
155 | { | ||
154 | /** | 156 | /** |
155 | * Name of the statistic we watch. | 157 | * Name of the statistic we watch. |
156 | */ | 158 | */ |
@@ -164,112 +166,112 @@ static struct WatchEntry { | |||
164 | { { "# Attempts to switch addresses", &stat_start_attempt_cb }, | 166 | { { "# Attempts to switch addresses", &stat_start_attempt_cb }, |
165 | { "# Successful attempts to switch addresses", &stat_success_attempt_cb }, | 167 | { "# Successful attempts to switch addresses", &stat_success_attempt_cb }, |
166 | { "# Failed attempts to switch addresses (failed to send CONNECT CONT)", | 168 | { "# Failed attempts to switch addresses (failed to send CONNECT CONT)", |
167 | &stat_fail_attempt_cb }, | 169 | &stat_fail_attempt_cb }, |
168 | { "# Failed attempts to switch addresses (failed to send CONNECT)", | 170 | { "# Failed attempts to switch addresses (failed to send CONNECT)", |
169 | &stat_fail_attempt_cb }, | 171 | &stat_fail_attempt_cb }, |
170 | { "# Failed attempts to switch addresses (no response)", | 172 | { "# Failed attempts to switch addresses (no response)", |
171 | &stat_fail_attempt_cb }, | 173 | &stat_fail_attempt_cb }, |
172 | { "# transport addresses", &stat_addresses_available }, | 174 | { "# transport addresses", &stat_addresses_available }, |
173 | { NULL, NULL } }; | 175 | { NULL, NULL } }; |
174 | 176 | ||
175 | 177 | ||
176 | static void | 178 | static void |
177 | custom_shutdown(void *cls) | 179 | custom_shutdown (void *cls) |
178 | { | 180 | { |
179 | int result; | 181 | int result; |
180 | 182 | ||
181 | if (NULL != measure_task) | 183 | if (NULL != measure_task) |
182 | { | 184 | { |
183 | GNUNET_SCHEDULER_cancel(measure_task); | 185 | GNUNET_SCHEDULER_cancel (measure_task); |
184 | measure_task = NULL; | 186 | measure_task = NULL; |
185 | } | 187 | } |
186 | if (0 == stats[0].switch_attempts + stats[1].switch_attempts) | 188 | if (0 == stats[0].switch_attempts + stats[1].switch_attempts) |
187 | { | 189 | { |
188 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, | 190 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
189 | "Test did not work, as peers didn't switch (flawed testcase)!\n"); | 191 | "Test did not work, as peers didn't switch (flawed testcase)!\n"); |
190 | ccc->global_ret = 77; | 192 | ccc->global_ret = 77; |
191 | } | 193 | } |
192 | else | 194 | else |
193 | { | 195 | { |
194 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 196 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
195 | "Fail (timeout)! No transmission after switch! Stopping peers\n"); | 197 | "Fail (timeout)! No transmission after switch! Stopping peers\n"); |
196 | ccc->global_ret = 77; /* GNUNET_SYSERR; */ | 198 | ccc->global_ret = 77; /* GNUNET_SYSERR; */ |
197 | } | 199 | } |
198 | 200 | ||
199 | /* stop statistics */ | 201 | /* stop statistics */ |
200 | for (unsigned int i = 0; i < 2; i++) | 202 | for (unsigned int i = 0; i < 2; i++) |
203 | { | ||
204 | if (NULL != stats[i].stat) | ||
201 | { | 205 | { |
202 | if (NULL != stats[i].stat) | 206 | for (unsigned int j = 0; NULL != watches[j].stat_name; j++) |
203 | { | 207 | GNUNET_assert (GNUNET_OK == |
204 | for (unsigned int j = 0; NULL != watches[j].stat_name; j++) | 208 | GNUNET_STATISTICS_watch_cancel (stats[i].stat, |
205 | GNUNET_assert(GNUNET_OK == | 209 | "transport", |
206 | GNUNET_STATISTICS_watch_cancel(stats[i].stat, | 210 | watches[j].stat_name, |
207 | "transport", | 211 | watches[j].stat_handler, |
208 | watches[j].stat_name, | 212 | &stats[i])); |
209 | watches[j].stat_handler, | 213 | GNUNET_STATISTICS_destroy (stats[i].stat, GNUNET_NO); |
210 | &stats[i])); | 214 | stats[i].stat = NULL; |
211 | GNUNET_STATISTICS_destroy(stats[i].stat, GNUNET_NO); | ||
212 | stats[i].stat = NULL; | ||
213 | } | ||
214 | } | 215 | } |
216 | } | ||
215 | 217 | ||
216 | result = 0; | 218 | result = 0; |
217 | fprintf(stderr, "\n"); | 219 | fprintf (stderr, "\n"); |
218 | if (stats[0].switch_attempts > 0) | 220 | if (stats[0].switch_attempts > 0) |
221 | { | ||
222 | fprintf ( | ||
223 | stderr, | ||
224 | "Peer 1 tried %u times to switch and succeeded %u times, failed %u times\n", | ||
225 | stats[0].switch_attempts, | ||
226 | stats[0].switch_success, | ||
227 | stats[0].switch_fail); | ||
228 | if (stats[0].switch_success != stats[0].switch_attempts) | ||
219 | { | 229 | { |
220 | fprintf( | 230 | GNUNET_break (0); |
221 | stderr, | 231 | result++; |
222 | "Peer 1 tried %u times to switch and succeeded %u times, failed %u times\n", | ||
223 | stats[0].switch_attempts, | ||
224 | stats[0].switch_success, | ||
225 | stats[0].switch_fail); | ||
226 | if (stats[0].switch_success != stats[0].switch_attempts) | ||
227 | { | ||
228 | GNUNET_break(0); | ||
229 | result++; | ||
230 | } | ||
231 | } | 232 | } |
233 | } | ||
232 | else if (stats[0].addresses_avail > 1) | 234 | else if (stats[0].addresses_avail > 1) |
233 | { | 235 | { |
234 | fprintf(stderr, | 236 | fprintf (stderr, |
235 | "Peer 1 had %u addresses available, but did not try to switch\n", | 237 | "Peer 1 had %u addresses available, but did not try to switch\n", |
236 | stats[0].addresses_avail); | 238 | stats[0].addresses_avail); |
237 | } | 239 | } |
238 | if (stats[1].switch_attempts > 0) | 240 | if (stats[1].switch_attempts > 0) |
241 | { | ||
242 | fprintf ( | ||
243 | stderr, | ||
244 | "Peer 2 tried %u times to switch and succeeded %u times, failed %u times\n", | ||
245 | stats[1].switch_attempts, | ||
246 | stats[1].switch_success, | ||
247 | stats[1].switch_fail); | ||
248 | if (stats[1].switch_success != stats[1].switch_attempts) | ||
239 | { | 249 | { |
240 | fprintf( | 250 | GNUNET_break (0); |
241 | stderr, | 251 | result++; |
242 | "Peer 2 tried %u times to switch and succeeded %u times, failed %u times\n", | ||
243 | stats[1].switch_attempts, | ||
244 | stats[1].switch_success, | ||
245 | stats[1].switch_fail); | ||
246 | if (stats[1].switch_success != stats[1].switch_attempts) | ||
247 | { | ||
248 | GNUNET_break(0); | ||
249 | result++; | ||
250 | } | ||
251 | } | 252 | } |
253 | } | ||
252 | else if (stats[1].addresses_avail > 1) | 254 | else if (stats[1].addresses_avail > 1) |
253 | { | 255 | { |
254 | fprintf(stderr, | 256 | fprintf (stderr, |
255 | "Peer 2 had %u addresses available, but did not try to switch\n", | 257 | "Peer 2 had %u addresses available, but did not try to switch\n", |
256 | stats[1].addresses_avail); | 258 | stats[1].addresses_avail); |
257 | } | 259 | } |
258 | 260 | ||
259 | if (((stats[0].switch_attempts > 0) || (stats[1].switch_attempts > 0)) && | 261 | if (((stats[0].switch_attempts > 0) || (stats[1].switch_attempts > 0)) && |
260 | (bytes_sent_after_switch == 0)) | 262 | (bytes_sent_after_switch == 0)) |
261 | { | 263 | { |
262 | fprintf(stderr, "No data sent after switching!\n"); | 264 | fprintf (stderr, "No data sent after switching!\n"); |
263 | GNUNET_break(0); | 265 | GNUNET_break (0); |
264 | result++; | 266 | result++; |
265 | } | 267 | } |
266 | if (((stats[0].switch_attempts > 0) || (stats[1].switch_attempts > 0)) && | 268 | if (((stats[0].switch_attempts > 0) || (stats[1].switch_attempts > 0)) && |
267 | (bytes_recv_after_switch == 0)) | 269 | (bytes_recv_after_switch == 0)) |
268 | { | 270 | { |
269 | fprintf(stderr, "No data received after switching!\n"); | 271 | fprintf (stderr, "No data received after switching!\n"); |
270 | GNUNET_break(0); | 272 | GNUNET_break (0); |
271 | result++; | 273 | result++; |
272 | } | 274 | } |
273 | #if 0 | 275 | #if 0 |
274 | /* This test is not really expected to pass right now... */ | 276 | /* This test is not really expected to pass right now... */ |
275 | if (0 != result) | 277 | if (0 != result) |
@@ -279,132 +281,132 @@ custom_shutdown(void *cls) | |||
279 | 281 | ||
280 | 282 | ||
281 | static void | 283 | static void |
282 | notify_receive(void *cls, | 284 | notify_receive (void *cls, |
283 | struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver, | 285 | struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver, |
284 | const struct GNUNET_PeerIdentity *sender, | 286 | const struct GNUNET_PeerIdentity *sender, |
285 | const struct GNUNET_TRANSPORT_TESTING_TestMessage *hdr) | 287 | const struct GNUNET_TRANSPORT_TESTING_TestMessage *hdr) |
286 | { | 288 | { |
287 | if (GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE != ntohs(hdr->header.type)) | 289 | if (GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE != ntohs (hdr->header.type)) |
288 | return; | 290 | return; |
289 | 291 | ||
290 | { | 292 | { |
291 | char *ps = GNUNET_strdup(GNUNET_i2s(&receiver->id)); | 293 | char *ps = GNUNET_strdup (GNUNET_i2s (&receiver->id)); |
292 | 294 | ||
293 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 295 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
294 | "Peer %u (`%s') got message %u of size %u from peer (`%s')\n", | 296 | "Peer %u (`%s') got message %u of size %u from peer (`%s')\n", |
295 | receiver->no, | 297 | receiver->no, |
296 | ps, | 298 | ps, |
297 | (uint32_t)ntohl(hdr->num), | 299 | (uint32_t) ntohl (hdr->num), |
298 | ntohs(hdr->header.size), | 300 | ntohs (hdr->header.size), |
299 | GNUNET_i2s(sender)); | 301 | GNUNET_i2s (sender)); |
300 | GNUNET_free(ps); | 302 | GNUNET_free (ps); |
301 | } | 303 | } |
302 | if (((stats[0].switch_attempts >= 1) || (stats[1].switch_attempts >= 1)) && | 304 | if (((stats[0].switch_attempts >= 1) || (stats[1].switch_attempts >= 1)) && |
303 | (stats[0].switch_attempts == | 305 | (stats[0].switch_attempts == |
304 | stats[0].switch_fail + stats[0].switch_success) && | 306 | stats[0].switch_fail + stats[0].switch_success) && |
305 | (stats[1].switch_attempts == | 307 | (stats[1].switch_attempts == |
306 | stats[1].switch_fail + stats[1].switch_success)) | 308 | stats[1].switch_fail + stats[1].switch_success)) |
309 | { | ||
310 | bytes_recv_after_switch += ntohs (hdr->header.size); | ||
311 | if ((bytes_sent_after_switch > 0) && (bytes_recv_after_switch > 0)) | ||
307 | { | 312 | { |
308 | bytes_recv_after_switch += ntohs(hdr->header.size); | 313 | /* A peer switched addresses and sent and received data after the |
309 | if ((bytes_sent_after_switch > 0) && (bytes_recv_after_switch > 0)) | 314 | * switch operations */ |
310 | { | 315 | GNUNET_SCHEDULER_shutdown (); |
311 | /* A peer switched addresses and sent and received data after the | ||
312 | * switch operations */ | ||
313 | GNUNET_SCHEDULER_shutdown(); | ||
314 | } | ||
315 | } | 316 | } |
317 | } | ||
316 | } | 318 | } |
317 | 319 | ||
318 | 320 | ||
319 | static void | 321 | static void |
320 | notify_send(void *cls) | 322 | notify_send (void *cls) |
321 | { | 323 | { |
322 | static uint32_t cnt; | 324 | static uint32_t cnt; |
323 | 325 | ||
324 | GNUNET_assert( | 326 | GNUNET_assert ( |
325 | GNUNET_OK == | 327 | GNUNET_OK == |
326 | GNUNET_TRANSPORT_TESTING_send(ccc->p[1], | 328 | GNUNET_TRANSPORT_TESTING_send (ccc->p[1], |
327 | ccc->p[0], | 329 | ccc->p[0], |
328 | GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE, | 330 | GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE, |
329 | GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE, | 331 | GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE, |
330 | ++cnt, | 332 | ++cnt, |
331 | ¬ify_send, | 333 | ¬ify_send, |
332 | NULL)); | 334 | NULL)); |
333 | if (((stats[0].switch_attempts >= 1) || (stats[1].switch_attempts >= 1)) && | 335 | if (((stats[0].switch_attempts >= 1) || (stats[1].switch_attempts >= 1)) && |
334 | (stats[0].switch_attempts == | 336 | (stats[0].switch_attempts == |
335 | stats[0].switch_fail + stats[0].switch_success) && | 337 | stats[0].switch_fail + stats[0].switch_success) && |
336 | (stats[1].switch_attempts == | 338 | (stats[1].switch_attempts == |
337 | stats[1].switch_fail + stats[1].switch_success)) | 339 | stats[1].switch_fail + stats[1].switch_success)) |
338 | { | 340 | { |
339 | bytes_sent_after_switch += GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE; | 341 | bytes_sent_after_switch += GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE; |
340 | } | 342 | } |
341 | } | 343 | } |
342 | 344 | ||
343 | 345 | ||
344 | static void | 346 | static void |
345 | progress_indicator(void *cls) | 347 | progress_indicator (void *cls) |
346 | { | 348 | { |
347 | static int counter; | 349 | static int counter; |
348 | 350 | ||
349 | measure_task = NULL; | 351 | measure_task = NULL; |
350 | counter++; | 352 | counter++; |
351 | if ((TIMEOUT.rel_value_us / 1000 / 1000LL) < counter) | 353 | if ((TIMEOUT.rel_value_us / 1000 / 1000LL) < counter) |
352 | { | 354 | { |
353 | fprintf(stderr, "%s", ".\n"); | 355 | fprintf (stderr, "%s", ".\n"); |
354 | } | 356 | } |
355 | else | 357 | else |
356 | { | 358 | { |
357 | fprintf(stderr, "%s", "."); | 359 | fprintf (stderr, "%s", "."); |
358 | measure_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, | 360 | measure_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
359 | &progress_indicator, | 361 | &progress_indicator, |
360 | NULL); | 362 | NULL); |
361 | } | 363 | } |
362 | } | 364 | } |
363 | 365 | ||
364 | 366 | ||
365 | static void | 367 | static void |
366 | connected_cb(void *cls) | 368 | connected_cb (void *cls) |
367 | { | 369 | { |
368 | for (unsigned int i = 0; i < 2; i++) | 370 | for (unsigned int i = 0; i < 2; i++) |
371 | { | ||
372 | stats[i].stat = GNUNET_STATISTICS_create ("transport", ccc->p[i]->cfg); | ||
373 | if (NULL == stats[i].stat) | ||
369 | { | 374 | { |
370 | stats[i].stat = GNUNET_STATISTICS_create("transport", ccc->p[i]->cfg); | 375 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
371 | if (NULL == stats[i].stat) | 376 | "Fail! Could not create statistics for peers!\n"); |
372 | { | 377 | ccc->global_ret = GNUNET_SYSERR; |
373 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 378 | GNUNET_SCHEDULER_shutdown (); |
374 | "Fail! Could not create statistics for peers!\n"); | 379 | return; |
375 | ccc->global_ret = GNUNET_SYSERR; | 380 | } |
376 | GNUNET_SCHEDULER_shutdown(); | 381 | for (unsigned int j = 0; NULL != watches[j].stat_name; j++) |
377 | return; | 382 | { |
378 | } | 383 | GNUNET_STATISTICS_watch (stats[i].stat, |
379 | for (unsigned int j = 0; NULL != watches[j].stat_name; j++) | 384 | "transport", |
380 | { | 385 | watches[j].stat_name, |
381 | GNUNET_STATISTICS_watch(stats[i].stat, | 386 | watches[j].stat_handler, |
382 | "transport", | 387 | &stats[i]); |
383 | watches[j].stat_name, | ||
384 | watches[j].stat_handler, | ||
385 | &stats[i]); | ||
386 | } | ||
387 | } | 388 | } |
389 | } | ||
388 | /* Show progress */ | 390 | /* Show progress */ |
389 | ccc->global_ret = GNUNET_OK; | 391 | ccc->global_ret = GNUNET_OK; |
390 | measure_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, | 392 | measure_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
391 | &progress_indicator, | 393 | &progress_indicator, |
392 | NULL); | 394 | NULL); |
393 | /* Peers are connected, start transmit test messages */ | 395 | /* Peers are connected, start transmit test messages */ |
394 | GNUNET_assert( | 396 | GNUNET_assert ( |
395 | GNUNET_OK == | 397 | GNUNET_OK == |
396 | GNUNET_TRANSPORT_TESTING_send(ccc->p[1], | 398 | GNUNET_TRANSPORT_TESTING_send (ccc->p[1], |
397 | ccc->p[0], | 399 | ccc->p[0], |
398 | GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE, | 400 | GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE, |
399 | GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE, | 401 | GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE, |
400 | 0, | 402 | 0, |
401 | ¬ify_send, | 403 | ¬ify_send, |
402 | NULL)); | 404 | NULL)); |
403 | } | 405 | } |
404 | 406 | ||
405 | 407 | ||
406 | int | 408 | int |
407 | main(int argc, char *argv[]) | 409 | main (int argc, char *argv[]) |
408 | { | 410 | { |
409 | struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = | 411 | struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = |
410 | { .connect_continuation = &connected_cb, | 412 | { .connect_continuation = &connected_cb, |
@@ -417,9 +419,9 @@ main(int argc, char *argv[]) | |||
417 | ccc = &my_ccc; | 419 | ccc = &my_ccc; |
418 | int ret; | 420 | int ret; |
419 | 421 | ||
420 | ret = GNUNET_TRANSPORT_TESTING_main(2, | 422 | ret = GNUNET_TRANSPORT_TESTING_main (2, |
421 | &GNUNET_TRANSPORT_TESTING_connect_check, | 423 | &GNUNET_TRANSPORT_TESTING_connect_check, |
422 | ccc); | 424 | ccc); |
423 | if (77 == ret) | 425 | if (77 == ret) |
424 | return 77; | 426 | return 77; |
425 | if (GNUNET_OK != ret) | 427 | if (GNUNET_OK != ret) |