diff options
Diffstat (limited to 'src/cadet/test_cadet_flow.c')
-rw-r--r-- | src/cadet/test_cadet_flow.c | 747 |
1 files changed, 373 insertions, 374 deletions
diff --git a/src/cadet/test_cadet_flow.c b/src/cadet/test_cadet_flow.c index 87e7b9a03..5278dc00f 100644 --- a/src/cadet/test_cadet_flow.c +++ b/src/cadet/test_cadet_flow.c | |||
@@ -11,12 +11,12 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file cadet/test_cadet_flow.c | 21 | * @file cadet/test_cadet_flow.c |
22 | * @author Bart Polot | 22 | * @author Bart Polot |
@@ -34,8 +34,7 @@ | |||
34 | /** | 34 | /** |
35 | * Ugly workaround to unify data handlers on incoming and outgoing channels. | 35 | * Ugly workaround to unify data handlers on incoming and outgoing channels. |
36 | */ | 36 | */ |
37 | struct CadetTestChannelWrapper | 37 | struct CadetTestChannelWrapper { |
38 | { | ||
39 | /** | 38 | /** |
40 | * Channel pointer. | 39 | * Channel pointer. |
41 | */ | 40 | */ |
@@ -50,17 +49,17 @@ struct CadetTestChannelWrapper | |||
50 | /** | 49 | /** |
51 | * How long until we give up on connecting the peers? | 50 | * How long until we give up on connecting the peers? |
52 | */ | 51 | */ |
53 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120) | 52 | #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 120) |
54 | 53 | ||
55 | /** | 54 | /** |
56 | * Time to wait by default for stuff that should be rather fast. | 55 | * Time to wait by default for stuff that should be rather fast. |
57 | */ | 56 | */ |
58 | #define SHORT_TIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 20) | 57 | #define SHORT_TIME GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 20) |
59 | 58 | ||
60 | /** | 59 | /** |
61 | * How fast do we send messages? | 60 | * How fast do we send messages? |
62 | */ | 61 | */ |
63 | #define SEND_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 10) | 62 | #define SEND_INTERVAL GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 10) |
64 | 63 | ||
65 | 64 | ||
66 | /** | 65 | /** |
@@ -76,7 +75,7 @@ static struct GNUNET_TIME_Relative short_time; | |||
76 | /** | 75 | /** |
77 | * Size of each test packet's payload | 76 | * Size of each test packet's payload |
78 | */ | 77 | */ |
79 | static size_t size_payload = sizeof (uint32_t); | 78 | static size_t size_payload = sizeof(uint32_t); |
80 | 79 | ||
81 | /** | 80 | /** |
82 | * Operation to get peer ids. | 81 | * Operation to get peer ids. |
@@ -209,29 +208,29 @@ static unsigned int msg_dropped; | |||
209 | * Show the results of the test (banwidth acheived) and log them to GAUGER | 208 | * Show the results of the test (banwidth acheived) and log them to GAUGER |
210 | */ | 209 | */ |
211 | static void | 210 | static void |
212 | show_end_data (void) | 211 | show_end_data(void) |
213 | { | 212 | { |
214 | static struct GNUNET_TIME_Absolute end_time; | 213 | static struct GNUNET_TIME_Absolute end_time; |
215 | static struct GNUNET_TIME_Relative total_time; | 214 | static struct GNUNET_TIME_Relative total_time; |
216 | 215 | ||
217 | end_time = GNUNET_TIME_absolute_get (); | 216 | end_time = GNUNET_TIME_absolute_get(); |
218 | total_time = GNUNET_TIME_absolute_get_difference (start_time, end_time); | 217 | total_time = GNUNET_TIME_absolute_get_difference(start_time, end_time); |
219 | fprintf (stderr, | 218 | fprintf(stderr, |
220 | "\nResults of test \"%s\"\n", | 219 | "\nResults of test \"%s\"\n", |
221 | test_name); | 220 | test_name); |
222 | fprintf (stderr, | 221 | fprintf(stderr, |
223 | "Test time %s\n", | 222 | "Test time %s\n", |
224 | GNUNET_STRINGS_relative_time_to_string (total_time, GNUNET_YES)); | 223 | GNUNET_STRINGS_relative_time_to_string(total_time, GNUNET_YES)); |
225 | fprintf (stderr, | 224 | fprintf(stderr, |
226 | "Test bandwidth: %f kb/s\n", | 225 | "Test bandwidth: %f kb/s\n", |
227 | 4 * total_packets * 1.0 / (total_time.rel_value_us / 1000)); // 4bytes * ms | 226 | 4 * total_packets * 1.0 / (total_time.rel_value_us / 1000)); // 4bytes * ms |
228 | fprintf (stderr, | 227 | fprintf(stderr, |
229 | "Test throughput: %f packets/s\n\n", | 228 | "Test throughput: %f packets/s\n\n", |
230 | total_packets * 1000.0 / (total_time.rel_value_us / 1000)); // packets * ms | 229 | total_packets * 1000.0 / (total_time.rel_value_us / 1000)); // packets * ms |
231 | GAUGER ("CADET", | 230 | GAUGER("CADET", |
232 | test_name, | 231 | test_name, |
233 | total_packets * 1000.0 / (total_time.rel_value_us / 1000), | 232 | total_packets * 1000.0 / (total_time.rel_value_us / 1000), |
234 | "packets/s"); | 233 | "packets/s"); |
235 | } | 234 | } |
236 | 235 | ||
237 | 236 | ||
@@ -242,33 +241,33 @@ show_end_data (void) | |||
242 | * @param tc Task Context. | 241 | * @param tc Task Context. |
243 | */ | 242 | */ |
244 | static void | 243 | static void |
245 | shutdown_task (void *cls) | 244 | shutdown_task(void *cls) |
246 | { | 245 | { |
247 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 246 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
248 | "Ending test.\n"); | 247 | "Ending test.\n"); |
249 | if (NULL != send_next_msg_task) | 248 | if (NULL != send_next_msg_task) |
250 | { | 249 | { |
251 | GNUNET_SCHEDULER_cancel (send_next_msg_task); | 250 | GNUNET_SCHEDULER_cancel(send_next_msg_task); |
252 | send_next_msg_task = NULL; | 251 | send_next_msg_task = NULL; |
253 | } | 252 | } |
254 | if (NULL != test_task) | 253 | if (NULL != test_task) |
255 | { | 254 | { |
256 | GNUNET_SCHEDULER_cancel (test_task); | 255 | GNUNET_SCHEDULER_cancel(test_task); |
257 | test_task = NULL; | 256 | test_task = NULL; |
258 | } | 257 | } |
259 | for (unsigned int i = 0; i < 2; i++) | 258 | for (unsigned int i = 0; i < 2; i++) |
260 | GNUNET_TESTBED_operation_done (t_op[i]); | 259 | GNUNET_TESTBED_operation_done(t_op[i]); |
261 | if (NULL != outgoing_ch) | 260 | if (NULL != outgoing_ch) |
262 | { | 261 | { |
263 | GNUNET_CADET_channel_destroy (outgoing_ch); | 262 | GNUNET_CADET_channel_destroy(outgoing_ch); |
264 | outgoing_ch = NULL; | 263 | outgoing_ch = NULL; |
265 | } | 264 | } |
266 | if (NULL != incoming_ch) | 265 | if (NULL != incoming_ch) |
267 | { | 266 | { |
268 | GNUNET_CADET_channel_destroy (incoming_ch); | 267 | GNUNET_CADET_channel_destroy(incoming_ch); |
269 | incoming_ch = NULL; | 268 | incoming_ch = NULL; |
270 | } | 269 | } |
271 | GNUNET_CADET_TEST_cleanup (test_ctx); | 270 | GNUNET_CADET_TEST_cleanup(test_ctx); |
272 | } | 271 | } |
273 | 272 | ||
274 | 273 | ||
@@ -282,25 +281,25 @@ shutdown_task (void *cls) | |||
282 | * operation has executed successfully. | 281 | * operation has executed successfully. |
283 | */ | 282 | */ |
284 | static void | 283 | static void |
285 | stats_cont (void *cls, | 284 | stats_cont(void *cls, |
286 | struct GNUNET_TESTBED_Operation *op, | 285 | struct GNUNET_TESTBED_Operation *op, |
287 | const char *emsg) | 286 | const char *emsg) |
288 | { | 287 | { |
289 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 288 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
290 | "KA sent: %u, KA received: %u\n", | 289 | "KA sent: %u, KA received: %u\n", |
291 | ka_sent, | 290 | ka_sent, |
292 | ka_received); | 291 | ka_received); |
293 | if ((KEEPALIVE == test) && ((ka_sent < 2) || (ka_sent > ka_received + 1))) | 292 | if ((KEEPALIVE == test) && ((ka_sent < 2) || (ka_sent > ka_received + 1))) |
294 | { | 293 | { |
295 | GNUNET_break (0); | 294 | GNUNET_break(0); |
296 | ok--; | 295 | ok--; |
297 | } | 296 | } |
298 | GNUNET_TESTBED_operation_done (stats_op); | 297 | GNUNET_TESTBED_operation_done(stats_op); |
299 | 298 | ||
300 | if (NULL != disconnect_task) | 299 | if (NULL != disconnect_task) |
301 | GNUNET_SCHEDULER_cancel (disconnect_task); | 300 | GNUNET_SCHEDULER_cancel(disconnect_task); |
302 | disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, | 301 | disconnect_task = GNUNET_SCHEDULER_add_now(&disconnect_cadet_peers, |
303 | cls); | 302 | cls); |
304 | } | 303 | } |
305 | 304 | ||
306 | 305 | ||
@@ -316,12 +315,12 @@ stats_cont (void *cls, | |||
316 | * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration | 315 | * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration |
317 | */ | 316 | */ |
318 | static int | 317 | static int |
319 | stats_iterator (void *cls, | 318 | stats_iterator(void *cls, |
320 | const struct GNUNET_TESTBED_Peer *peer, | 319 | const struct GNUNET_TESTBED_Peer *peer, |
321 | const char *subsystem, | 320 | const char *subsystem, |
322 | const char *name, | 321 | const char *name, |
323 | uint64_t value, | 322 | uint64_t value, |
324 | int is_persistent) | 323 | int is_persistent) |
325 | { | 324 | { |
326 | static const char *s_sent = "# keepalives sent"; | 325 | static const char *s_sent = "# keepalives sent"; |
327 | static const char *s_recv = "# keepalives received"; | 326 | static const char *s_recv = "# keepalives received"; |
@@ -329,16 +328,16 @@ stats_iterator (void *cls, | |||
329 | static const char *cdrops = "# messages dropped due to slow client"; | 328 | static const char *cdrops = "# messages dropped due to slow client"; |
330 | uint32_t i; | 329 | uint32_t i; |
331 | 330 | ||
332 | i = GNUNET_TESTBED_get_index (peer); | 331 | i = GNUNET_TESTBED_get_index(peer); |
333 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "STATS PEER %u - %s [%s]: %llu\n", i, | 332 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "STATS PEER %u - %s [%s]: %llu\n", i, |
334 | subsystem, name, (unsigned long long) value); | 333 | subsystem, name, (unsigned long long)value); |
335 | if (0 == strncmp (s_sent, name, strlen (s_sent)) && 0 == i) | 334 | if (0 == strncmp(s_sent, name, strlen(s_sent)) && 0 == i) |
336 | ka_sent = value; | 335 | ka_sent = value; |
337 | if (0 == strncmp (s_recv, name, strlen (s_recv)) && peers_requested - 1 == i) | 336 | if (0 == strncmp(s_recv, name, strlen(s_recv)) && peers_requested - 1 == i) |
338 | ka_received = value; | 337 | ka_received = value; |
339 | if (0 == strncmp (rdrops, name, strlen (rdrops))) | 338 | if (0 == strncmp(rdrops, name, strlen(rdrops))) |
340 | msg_dropped += value; | 339 | msg_dropped += value; |
341 | if (0 == strncmp (cdrops, name, strlen (cdrops))) | 340 | if (0 == strncmp(cdrops, name, strlen(cdrops))) |
342 | msg_dropped += value; | 341 | msg_dropped += value; |
343 | 342 | ||
344 | return GNUNET_OK; | 343 | return GNUNET_OK; |
@@ -351,26 +350,26 @@ stats_iterator (void *cls, | |||
351 | * @param cls Closure (line from which the task was scheduled). | 350 | * @param cls Closure (line from which the task was scheduled). |
352 | */ | 351 | */ |
353 | static void | 352 | static void |
354 | gather_stats_and_exit (void *cls) | 353 | gather_stats_and_exit(void *cls) |
355 | { | 354 | { |
356 | long l = (long) cls; | 355 | long l = (long)cls; |
357 | 356 | ||
358 | disconnect_task = NULL; | 357 | disconnect_task = NULL; |
359 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 358 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
360 | "gathering statistics from line %ld\n", | 359 | "gathering statistics from line %ld\n", |
361 | l); | 360 | l); |
362 | if (NULL != outgoing_ch) | 361 | if (NULL != outgoing_ch) |
363 | { | 362 | { |
364 | GNUNET_CADET_channel_destroy (outgoing_ch); | 363 | GNUNET_CADET_channel_destroy(outgoing_ch); |
365 | outgoing_ch = NULL; | 364 | outgoing_ch = NULL; |
366 | } | 365 | } |
367 | stats_op = GNUNET_TESTBED_get_statistics (peers_running, | 366 | stats_op = GNUNET_TESTBED_get_statistics(peers_running, |
368 | testbed_peers, | 367 | testbed_peers, |
369 | "cadet", | 368 | "cadet", |
370 | NULL, | 369 | NULL, |
371 | &stats_iterator, | 370 | &stats_iterator, |
372 | stats_cont, | 371 | stats_cont, |
373 | cls); | 372 | cls); |
374 | } | 373 | } |
375 | 374 | ||
376 | 375 | ||
@@ -380,18 +379,18 @@ gather_stats_and_exit (void *cls) | |||
380 | * @param line Line in the code the abort is requested from (__LINE__). | 379 | * @param line Line in the code the abort is requested from (__LINE__). |
381 | */ | 380 | */ |
382 | static void | 381 | static void |
383 | abort_test (long line) | 382 | abort_test(long line) |
384 | { | 383 | { |
385 | if (NULL != disconnect_task) | 384 | if (NULL != disconnect_task) |
386 | { | 385 | { |
387 | GNUNET_SCHEDULER_cancel (disconnect_task); | 386 | GNUNET_SCHEDULER_cancel(disconnect_task); |
388 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 387 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
389 | "Aborting test from %ld\n", | 388 | "Aborting test from %ld\n", |
390 | line); | 389 | line); |
391 | disconnect_task = | 390 | disconnect_task = |
392 | GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, | 391 | GNUNET_SCHEDULER_add_now(&disconnect_cadet_peers, |
393 | (void *) line); | 392 | (void *)line); |
394 | } | 393 | } |
395 | } | 394 | } |
396 | 395 | ||
397 | 396 | ||
@@ -403,7 +402,7 @@ abort_test (long line) | |||
403 | * @param channel Channel to send the message on. | 402 | * @param channel Channel to send the message on. |
404 | */ | 403 | */ |
405 | static void | 404 | static void |
406 | send_test_message (struct GNUNET_CADET_Channel *channel) | 405 | send_test_message(struct GNUNET_CADET_Channel *channel) |
407 | { | 406 | { |
408 | struct GNUNET_MQ_Envelope *env; | 407 | struct GNUNET_MQ_Envelope *env; |
409 | struct GNUNET_MessageHeader *msg; | 408 | struct GNUNET_MessageHeader *msg; |
@@ -411,56 +410,56 @@ send_test_message (struct GNUNET_CADET_Channel *channel) | |||
411 | int payload; | 410 | int payload; |
412 | int size; | 411 | int size; |
413 | 412 | ||
414 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 413 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
415 | "Sending test message on channel %p\n", | 414 | "Sending test message on channel %p\n", |
416 | channel); | 415 | channel); |
417 | size = size_payload; | 416 | size = size_payload; |
418 | if (GNUNET_NO == initialized) | 417 | if (GNUNET_NO == initialized) |
419 | { | 418 | { |
420 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending INITIALIZER\n"); | 419 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending INITIALIZER\n"); |
421 | size += 1000; | 420 | size += 1000; |
422 | payload = data_sent; | 421 | payload = data_sent; |
423 | if (SPEED_ACK == test) // FIXME unify SPEED_ACK with an initializer | 422 | if (SPEED_ACK == test) // FIXME unify SPEED_ACK with an initializer |
424 | data_sent++; | 423 | data_sent++; |
425 | } | 424 | } |
426 | else if (SPEED == test || SPEED_ACK == test) | 425 | else if (SPEED == test || SPEED_ACK == test) |
427 | { | 426 | { |
428 | if (get_target_channel() == channel) | 427 | if (get_target_channel() == channel) |
428 | { | ||
429 | payload = ack_sent; | ||
430 | size += ack_sent; | ||
431 | ack_sent++; | ||
432 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
433 | "Sending ACK %u [%d bytes]\n", | ||
434 | payload, size); | ||
435 | } | ||
436 | else | ||
437 | { | ||
438 | payload = data_sent; | ||
439 | size += data_sent; | ||
440 | data_sent++; | ||
441 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
442 | "Sending DATA %u [%d bytes]\n", | ||
443 | data_sent, size); | ||
444 | } | ||
445 | } | ||
446 | else if (FORWARD == test) | ||
429 | { | 447 | { |
430 | payload = ack_sent; | 448 | payload = ack_sent; |
431 | size += ack_sent; | ||
432 | ack_sent++; | ||
433 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
434 | "Sending ACK %u [%d bytes]\n", | ||
435 | payload, size); | ||
436 | } | 449 | } |
437 | else | 450 | else if (P2P_SIGNAL == test) |
438 | { | 451 | { |
439 | payload = data_sent; | 452 | payload = data_sent; |
440 | size += data_sent; | ||
441 | data_sent++; | ||
442 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
443 | "Sending DATA %u [%d bytes]\n", | ||
444 | data_sent, size); | ||
445 | } | 453 | } |
446 | } | ||
447 | else if (FORWARD == test) | ||
448 | { | ||
449 | payload = ack_sent; | ||
450 | } | ||
451 | else if (P2P_SIGNAL == test) | ||
452 | { | ||
453 | payload = data_sent; | ||
454 | } | ||
455 | else | 454 | else |
456 | { | 455 | { |
457 | GNUNET_assert (0); | 456 | GNUNET_assert(0); |
458 | } | 457 | } |
459 | env = GNUNET_MQ_msg_extra (msg, size, GNUNET_MESSAGE_TYPE_DUMMY); | 458 | env = GNUNET_MQ_msg_extra(msg, size, GNUNET_MESSAGE_TYPE_DUMMY); |
460 | 459 | ||
461 | data = (uint32_t *) &msg[1]; | 460 | data = (uint32_t *)&msg[1]; |
462 | *data = htonl (payload); | 461 | *data = htonl(payload); |
463 | GNUNET_MQ_send (GNUNET_CADET_get_mq (channel), env); | 462 | GNUNET_MQ_send(GNUNET_CADET_get_mq(channel), env); |
464 | } | 463 | } |
465 | 464 | ||
466 | 465 | ||
@@ -471,30 +470,30 @@ send_test_message (struct GNUNET_CADET_Channel *channel) | |||
471 | * @param cls Closure (unused). | 470 | * @param cls Closure (unused). |
472 | */ | 471 | */ |
473 | static void | 472 | static void |
474 | send_next_msg (void *cls) | 473 | send_next_msg(void *cls) |
475 | { | 474 | { |
476 | struct GNUNET_CADET_Channel *channel; | 475 | struct GNUNET_CADET_Channel *channel; |
477 | 476 | ||
478 | send_next_msg_task = NULL; | 477 | send_next_msg_task = NULL; |
479 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 478 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
480 | "Sending next message: %d\n", | 479 | "Sending next message: %d\n", |
481 | data_sent); | 480 | data_sent); |
482 | 481 | ||
483 | channel = GNUNET_YES == test_backwards ? incoming_ch : outgoing_ch; | 482 | channel = GNUNET_YES == test_backwards ? incoming_ch : outgoing_ch; |
484 | GNUNET_assert (NULL != channel); | 483 | GNUNET_assert(NULL != channel); |
485 | GNUNET_assert (SPEED == test); | 484 | GNUNET_assert(SPEED == test); |
486 | send_test_message (channel); | 485 | send_test_message(channel); |
487 | if (data_sent < total_packets) | 486 | if (data_sent < total_packets) |
488 | { | 487 | { |
489 | /* SPEED test: Send all messages as soon as possible */ | 488 | /* SPEED test: Send all messages as soon as possible */ |
490 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 489 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
491 | "Scheduling message %d\n", | 490 | "Scheduling message %d\n", |
492 | data_sent + 1); | 491 | data_sent + 1); |
493 | send_next_msg_task = | 492 | send_next_msg_task = |
494 | GNUNET_SCHEDULER_add_delayed (SEND_INTERVAL, | 493 | GNUNET_SCHEDULER_add_delayed(SEND_INTERVAL, |
495 | &send_next_msg, | 494 | &send_next_msg, |
496 | NULL); | 495 | NULL); |
497 | } | 496 | } |
498 | } | 497 | } |
499 | 498 | ||
500 | 499 | ||
@@ -507,8 +506,8 @@ send_next_msg (void *cls) | |||
507 | * #GNUNET_SYSERR to close it (signal serious error). | 506 | * #GNUNET_SYSERR to close it (signal serious error). |
508 | */ | 507 | */ |
509 | static int | 508 | static int |
510 | check_data (void *cls, | 509 | check_data(void *cls, |
511 | const struct GNUNET_MessageHeader *message) | 510 | const struct GNUNET_MessageHeader *message) |
512 | { | 511 | { |
513 | return GNUNET_OK; /* all is well-formed */ | 512 | return GNUNET_OK; /* all is well-formed */ |
514 | } | 513 | } |
@@ -521,8 +520,8 @@ check_data (void *cls, | |||
521 | * @param message the actual message | 520 | * @param message the actual message |
522 | */ | 521 | */ |
523 | static void | 522 | static void |
524 | handle_data (void *cls, | 523 | handle_data(void *cls, |
525 | const struct GNUNET_MessageHeader *message) | 524 | const struct GNUNET_MessageHeader *message) |
526 | { | 525 | { |
527 | struct CadetTestChannelWrapper *ch = cls; | 526 | struct CadetTestChannelWrapper *ch = cls; |
528 | struct GNUNET_CADET_Channel *channel = ch->ch; | 527 | struct GNUNET_CADET_Channel *channel = ch->ch; |
@@ -530,73 +529,73 @@ handle_data (void *cls, | |||
530 | uint32_t payload; | 529 | uint32_t payload; |
531 | int *counter; | 530 | int *counter; |
532 | 531 | ||
533 | GNUNET_CADET_receive_done (channel); | 532 | GNUNET_CADET_receive_done(channel); |
534 | counter = get_target_channel () == channel ? &data_received : &ack_received; | 533 | counter = get_target_channel() == channel ? &data_received : &ack_received; |
535 | if (channel == outgoing_ch) | 534 | if (channel == outgoing_ch) |
536 | { | 535 | { |
537 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 536 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
538 | "Root client got a message.\n"); | 537 | "Root client got a message.\n"); |
539 | } | 538 | } |
540 | else if (channel == incoming_ch) | 539 | else if (channel == incoming_ch) |
541 | { | 540 | { |
542 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 541 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
543 | "Leaf client got a message.\n"); | 542 | "Leaf client got a message.\n"); |
544 | } | 543 | } |
545 | else | 544 | else |
546 | { | 545 | { |
547 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 546 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
548 | "Unknown channel %p.\n", | 547 | "Unknown channel %p.\n", |
549 | channel); | 548 | channel); |
550 | GNUNET_assert (0); | 549 | GNUNET_assert(0); |
551 | } | 550 | } |
552 | 551 | ||
553 | data = (uint32_t *) &message[1]; | 552 | data = (uint32_t *)&message[1]; |
554 | payload = ntohl (*data); | 553 | payload = ntohl(*data); |
555 | if (payload == *counter) | 554 | if (payload == *counter) |
556 | { | 555 | { |
557 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 556 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
558 | "Payload as expected: %u\n", | 557 | "Payload as expected: %u\n", |
559 | payload); | 558 | payload); |
560 | } | 559 | } |
561 | else | 560 | else |
562 | { | ||
563 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
564 | "Received payload %u, expected: %u\n", | ||
565 | payload, *counter); | ||
566 | } | ||
567 | (*counter)++; | ||
568 | if (get_target_channel () == channel) /* Got "data" */ | ||
569 | { | ||
570 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
571 | " received data %u\n", | ||
572 | data_received); | ||
573 | if (data_received < total_packets) | ||
574 | return; | ||
575 | } | ||
576 | else /* Got "ack" */ | ||
577 | { | ||
578 | if (SPEED_ACK == test || SPEED == test) | ||
579 | { | 561 | { |
580 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received ack %u\n", ack_received); | 562 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
581 | /* Send more data */ | 563 | "Received payload %u, expected: %u\n", |
582 | send_test_message (channel); | 564 | payload, *counter); |
583 | if (ack_received < total_packets && SPEED != test) | ||
584 | return; | ||
585 | if (ok == 2 && SPEED == test) | ||
586 | return; | ||
587 | show_end_data (); | ||
588 | } | 565 | } |
589 | if (test == P2P_SIGNAL) | 566 | (*counter)++; |
567 | if (get_target_channel() == channel) /* Got "data" */ | ||
590 | { | 568 | { |
591 | GNUNET_CADET_channel_destroy (incoming_ch); | 569 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
592 | incoming_ch = NULL; | 570 | " received data %u\n", |
571 | data_received); | ||
572 | if (data_received < total_packets) | ||
573 | return; | ||
593 | } | 574 | } |
594 | else | 575 | else /* Got "ack" */ |
595 | { | 576 | { |
596 | GNUNET_CADET_channel_destroy (outgoing_ch); | 577 | if (SPEED_ACK == test || SPEED == test) |
597 | outgoing_ch = NULL; | 578 | { |
579 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, " received ack %u\n", ack_received); | ||
580 | /* Send more data */ | ||
581 | send_test_message(channel); | ||
582 | if (ack_received < total_packets && SPEED != test) | ||
583 | return; | ||
584 | if (ok == 2 && SPEED == test) | ||
585 | return; | ||
586 | show_end_data(); | ||
587 | } | ||
588 | if (test == P2P_SIGNAL) | ||
589 | { | ||
590 | GNUNET_CADET_channel_destroy(incoming_ch); | ||
591 | incoming_ch = NULL; | ||
592 | } | ||
593 | else | ||
594 | { | ||
595 | GNUNET_CADET_channel_destroy(outgoing_ch); | ||
596 | outgoing_ch = NULL; | ||
597 | } | ||
598 | } | 598 | } |
599 | } | ||
600 | } | 599 | } |
601 | 600 | ||
602 | 601 | ||
@@ -613,37 +612,37 @@ handle_data (void *cls, | |||
613 | * received on the @a channel. | 612 | * received on the @a channel. |
614 | */ | 613 | */ |
615 | static void * | 614 | static void * |
616 | connect_handler (void *cls, | 615 | connect_handler(void *cls, |
617 | struct GNUNET_CADET_Channel *channel, | 616 | struct GNUNET_CADET_Channel *channel, |
618 | const struct GNUNET_PeerIdentity *source) | 617 | const struct GNUNET_PeerIdentity *source) |
619 | { | 618 | { |
620 | struct CadetTestChannelWrapper *ch; | 619 | struct CadetTestChannelWrapper *ch; |
621 | long peer = (long) cls; | 620 | long peer = (long)cls; |
622 | 621 | ||
623 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 622 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
624 | "Incoming channel from %s to %ld: %p\n", | 623 | "Incoming channel from %s to %ld: %p\n", |
625 | GNUNET_i2s (source), | 624 | GNUNET_i2s(source), |
626 | peer, | 625 | peer, |
627 | channel); | 626 | channel); |
628 | if (peer == peers_requested - 1) | 627 | if (peer == peers_requested - 1) |
629 | { | ||
630 | if (NULL != incoming_ch) | ||
631 | { | 628 | { |
632 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 629 | if (NULL != incoming_ch) |
633 | "Duplicate incoming channel for client %lu\n", | 630 | { |
634 | (long) cls); | 631 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
635 | GNUNET_assert (0); | 632 | "Duplicate incoming channel for client %lu\n", |
633 | (long)cls); | ||
634 | GNUNET_assert(0); | ||
635 | } | ||
636 | incoming_ch = channel; | ||
636 | } | 637 | } |
637 | incoming_ch = channel; | ||
638 | } | ||
639 | else | 638 | else |
640 | { | 639 | { |
641 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 640 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, |
642 | "Incoming channel for unexpected peer #%lu\n", | 641 | "Incoming channel for unexpected peer #%lu\n", |
643 | (long) cls); | 642 | (long)cls); |
644 | GNUNET_assert (0); | 643 | GNUNET_assert(0); |
645 | } | 644 | } |
646 | ch = GNUNET_new (struct CadetTestChannelWrapper); | 645 | ch = GNUNET_new(struct CadetTestChannelWrapper); |
647 | ch->ch = channel; | 646 | ch->ch = channel; |
648 | 647 | ||
649 | return ch; | 648 | return ch; |
@@ -662,28 +661,28 @@ connect_handler (void *cls, | |||
662 | * @param channel Connection to the other end (henceforth invalid). | 661 | * @param channel Connection to the other end (henceforth invalid). |
663 | */ | 662 | */ |
664 | static void | 663 | static void |
665 | disconnect_handler (void *cls, | 664 | disconnect_handler(void *cls, |
666 | const struct GNUNET_CADET_Channel *channel) | 665 | const struct GNUNET_CADET_Channel *channel) |
667 | { | 666 | { |
668 | struct CadetTestChannelWrapper *ch_w = cls; | 667 | struct CadetTestChannelWrapper *ch_w = cls; |
669 | 668 | ||
670 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 669 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
671 | "Channel disconnected at %d\n", | 670 | "Channel disconnected at %d\n", |
672 | ok); | 671 | ok); |
673 | GNUNET_assert (ch_w->ch == channel); | 672 | GNUNET_assert(ch_w->ch == channel); |
674 | if (channel == incoming_ch) | 673 | if (channel == incoming_ch) |
675 | incoming_ch = NULL; | 674 | incoming_ch = NULL; |
676 | else if (outgoing_ch == channel) | 675 | else if (outgoing_ch == channel) |
677 | outgoing_ch = NULL; | 676 | outgoing_ch = NULL; |
678 | else | 677 | else |
679 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 678 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, |
680 | "Disconnect on unknown channel %p\n", | 679 | "Disconnect on unknown channel %p\n", |
681 | channel); | 680 | channel); |
682 | if (NULL != disconnect_task) | 681 | if (NULL != disconnect_task) |
683 | GNUNET_SCHEDULER_cancel (disconnect_task); | 682 | GNUNET_SCHEDULER_cancel(disconnect_task); |
684 | disconnect_task = GNUNET_SCHEDULER_add_now (&gather_stats_and_exit, | 683 | disconnect_task = GNUNET_SCHEDULER_add_now(&gather_stats_and_exit, |
685 | (void *) __LINE__); | 684 | (void *)__LINE__); |
686 | GNUNET_free (ch_w); | 685 | GNUNET_free(ch_w); |
687 | } | 686 | } |
688 | 687 | ||
689 | 688 | ||
@@ -696,41 +695,41 @@ disconnect_handler (void *cls, | |||
696 | * @param cls Closure (unused). | 695 | * @param cls Closure (unused). |
697 | */ | 696 | */ |
698 | static void | 697 | static void |
699 | start_test (void *cls) | 698 | start_test(void *cls) |
700 | { | 699 | { |
701 | struct GNUNET_MQ_MessageHandler handlers[] = { | 700 | struct GNUNET_MQ_MessageHandler handlers[] = { |
702 | GNUNET_MQ_hd_var_size (data, | 701 | GNUNET_MQ_hd_var_size(data, |
703 | GNUNET_MESSAGE_TYPE_DUMMY, | 702 | GNUNET_MESSAGE_TYPE_DUMMY, |
704 | struct GNUNET_MessageHeader, | 703 | struct GNUNET_MessageHeader, |
705 | NULL), | 704 | NULL), |
706 | GNUNET_MQ_handler_end () | 705 | GNUNET_MQ_handler_end() |
707 | }; | 706 | }; |
708 | struct CadetTestChannelWrapper *ch; | 707 | struct CadetTestChannelWrapper *ch; |
709 | enum GNUNET_CADET_ChannelOption flags; | 708 | enum GNUNET_CADET_ChannelOption flags; |
710 | 709 | ||
711 | test_task = NULL; | 710 | test_task = NULL; |
712 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 711 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
713 | "In start_test\n"); | 712 | "In start_test\n"); |
714 | start_time = GNUNET_TIME_absolute_get (); | 713 | start_time = GNUNET_TIME_absolute_get(); |
715 | ch = GNUNET_new (struct CadetTestChannelWrapper); | 714 | ch = GNUNET_new(struct CadetTestChannelWrapper); |
716 | outgoing_ch = GNUNET_CADET_channel_create (h1, | 715 | outgoing_ch = GNUNET_CADET_channel_create(h1, |
717 | ch, | 716 | ch, |
718 | p_id[1], | 717 | p_id[1], |
719 | &port, | 718 | &port, |
720 | flags, | 719 | flags, |
721 | NULL, | 720 | NULL, |
722 | &disconnect_handler, | 721 | &disconnect_handler, |
723 | handlers); | 722 | handlers); |
724 | ch->ch = outgoing_ch; | 723 | ch->ch = outgoing_ch; |
725 | GNUNET_assert (NULL == disconnect_task); | 724 | GNUNET_assert(NULL == disconnect_task); |
726 | disconnect_task | 725 | disconnect_task |
727 | = GNUNET_SCHEDULER_add_delayed (short_time, | 726 | = GNUNET_SCHEDULER_add_delayed(short_time, |
728 | &gather_stats_and_exit, | 727 | &gather_stats_and_exit, |
729 | (void *) __LINE__); | 728 | (void *)__LINE__); |
730 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 729 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
731 | "Sending data initializer on channel %p...\n", | 730 | "Sending data initializer on channel %p...\n", |
732 | outgoing_ch); | 731 | outgoing_ch); |
733 | send_test_message (outgoing_ch); | 732 | send_test_message(outgoing_ch); |
734 | } | 733 | } |
735 | 734 | ||
736 | 735 | ||
@@ -744,36 +743,36 @@ start_test (void *cls) | |||
744 | * NULL if the operation is successfull | 743 | * NULL if the operation is successfull |
745 | */ | 744 | */ |
746 | static void | 745 | static void |
747 | pi_cb (void *cls, | 746 | pi_cb(void *cls, |
748 | struct GNUNET_TESTBED_Operation *op, | 747 | struct GNUNET_TESTBED_Operation *op, |
749 | const struct GNUNET_TESTBED_PeerInformation *pinfo, | 748 | const struct GNUNET_TESTBED_PeerInformation *pinfo, |
750 | const char *emsg) | 749 | const char *emsg) |
751 | { | 750 | { |
752 | long i = (long) cls; | 751 | long i = (long)cls; |
753 | 752 | ||
754 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 753 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
755 | "ID callback for %ld\n", | 754 | "ID callback for %ld\n", |
756 | i); | 755 | i); |
757 | if ( (NULL == pinfo) || | 756 | if ((NULL == pinfo) || |
758 | (NULL != emsg) ) | 757 | (NULL != emsg)) |
759 | { | 758 | { |
760 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 759 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
761 | "pi_cb: %s\n", | 760 | "pi_cb: %s\n", |
762 | emsg); | 761 | emsg); |
763 | abort_test (__LINE__); | 762 | abort_test(__LINE__); |
764 | return; | 763 | return; |
765 | } | 764 | } |
766 | p_id[i] = pinfo->result.id; | 765 | p_id[i] = pinfo->result.id; |
767 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 766 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
768 | "id: %s\n", | 767 | "id: %s\n", |
769 | GNUNET_i2s (p_id[i])); | 768 | GNUNET_i2s(p_id[i])); |
770 | p_ids++; | 769 | p_ids++; |
771 | if (p_ids < 2) | 770 | if (p_ids < 2) |
772 | return; | 771 | return; |
773 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 772 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
774 | "Got all IDs, starting test\n"); | 773 | "Got all IDs, starting test\n"); |
775 | test_task = GNUNET_SCHEDULER_add_now (&start_test, | 774 | test_task = GNUNET_SCHEDULER_add_now(&start_test, |
776 | NULL); | 775 | NULL); |
777 | } | 776 | } |
778 | 777 | ||
779 | 778 | ||
@@ -787,33 +786,33 @@ pi_cb (void *cls, | |||
787 | * @param cadets Handle to each of the CADETs of the peers. | 786 | * @param cadets Handle to each of the CADETs of the peers. |
788 | */ | 787 | */ |
789 | static void | 788 | static void |
790 | tmain (void *cls, | 789 | tmain(void *cls, |
791 | struct GNUNET_CADET_TEST_Context *ctx, | 790 | struct GNUNET_CADET_TEST_Context *ctx, |
792 | unsigned int num_peers, | 791 | unsigned int num_peers, |
793 | struct GNUNET_TESTBED_Peer **peers, | 792 | struct GNUNET_TESTBED_Peer **peers, |
794 | struct GNUNET_CADET_Handle **cadets) | 793 | struct GNUNET_CADET_Handle **cadets) |
795 | { | 794 | { |
796 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 795 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
797 | "test main\n"); | 796 | "test main\n"); |
798 | test_ctx = ctx; | 797 | test_ctx = ctx; |
799 | peers_running = num_peers; | 798 | peers_running = num_peers; |
800 | GNUNET_assert (peers_running == peers_requested); | 799 | GNUNET_assert(peers_running == peers_requested); |
801 | testbed_peers = peers; | 800 | testbed_peers = peers; |
802 | h1 = cadets[0]; | 801 | h1 = cadets[0]; |
803 | h2 = cadets[num_peers - 1]; | 802 | h2 = cadets[num_peers - 1]; |
804 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | 803 | GNUNET_SCHEDULER_add_shutdown(&shutdown_task, |
805 | NULL); | 804 | NULL); |
806 | p_ids = 0; | 805 | p_ids = 0; |
807 | t_op[0] = GNUNET_TESTBED_peer_get_information (peers[0], | 806 | t_op[0] = GNUNET_TESTBED_peer_get_information(peers[0], |
808 | GNUNET_TESTBED_PIT_IDENTITY, | 807 | GNUNET_TESTBED_PIT_IDENTITY, |
809 | &pi_cb, | 808 | &pi_cb, |
810 | (void *) 0L); | 809 | (void *)0L); |
811 | t_op[1] = GNUNET_TESTBED_peer_get_information (peers[num_peers - 1], | 810 | t_op[1] = GNUNET_TESTBED_peer_get_information(peers[num_peers - 1], |
812 | GNUNET_TESTBED_PIT_IDENTITY, | 811 | GNUNET_TESTBED_PIT_IDENTITY, |
813 | &pi_cb, | 812 | &pi_cb, |
814 | (void *) 1L); | 813 | (void *)1L); |
815 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 814 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
816 | "requested peer ids\n"); | 815 | "requested peer ids\n"); |
817 | } | 816 | } |
818 | 817 | ||
819 | 818 | ||
@@ -821,67 +820,67 @@ tmain (void *cls, | |||
821 | * Main: start test | 820 | * Main: start test |
822 | */ | 821 | */ |
823 | int | 822 | int |
824 | main (int argc, | 823 | main(int argc, |
825 | char *argv[]) | 824 | char *argv[]) |
826 | { | 825 | { |
827 | static const struct GNUNET_HashCode *ports[2]; | 826 | static const struct GNUNET_HashCode *ports[2]; |
828 | struct GNUNET_MQ_MessageHandler handlers[] = { | 827 | struct GNUNET_MQ_MessageHandler handlers[] = { |
829 | GNUNET_MQ_hd_var_size (data, | 828 | GNUNET_MQ_hd_var_size(data, |
830 | GNUNET_MESSAGE_TYPE_DUMMY, | 829 | GNUNET_MESSAGE_TYPE_DUMMY, |
831 | struct GNUNET_MessageHeader, | 830 | struct GNUNET_MessageHeader, |
832 | NULL), | 831 | NULL), |
833 | GNUNET_MQ_handler_end () | 832 | GNUNET_MQ_handler_end() |
834 | }; | 833 | }; |
835 | const char *config_file = "test_cadet.conf"; | 834 | const char *config_file = "test_cadet.conf"; |
836 | char port_id[] = "test port"; | 835 | char port_id[] = "test port"; |
837 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 836 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
838 | GNUNET_GETOPT_option_relative_time ('t', | 837 | GNUNET_GETOPT_option_relative_time('t', |
839 | "time", | 838 | "time", |
840 | "short_time", | 839 | "short_time", |
841 | gettext_noop ("set short timeout"), | 840 | gettext_noop("set short timeout"), |
842 | &short_time), | 841 | &short_time), |
843 | GNUNET_GETOPT_option_uint ('m', | 842 | GNUNET_GETOPT_option_uint('m', |
844 | "messages", | 843 | "messages", |
845 | "NUM_MESSAGES", | 844 | "NUM_MESSAGES", |
846 | gettext_noop ("set number of messages to send"), | 845 | gettext_noop("set number of messages to send"), |
847 | &total_packets), | 846 | &total_packets), |
848 | GNUNET_GETOPT_option_uint ('p', | 847 | GNUNET_GETOPT_option_uint('p', |
849 | "peers", | 848 | "peers", |
850 | "NUM_PEERS", | 849 | "NUM_PEERS", |
851 | gettext_noop ("number of peers to launch"), | 850 | gettext_noop("number of peers to launch"), |
852 | &peers_requested), | 851 | &peers_requested), |
853 | GNUNET_GETOPT_OPTION_END | 852 | GNUNET_GETOPT_OPTION_END |
854 | }; | 853 | }; |
855 | 854 | ||
856 | GNUNET_log_setup ("test-cadet-flow", | 855 | GNUNET_log_setup("test-cadet-flow", |
857 | "DEBUG", | 856 | "DEBUG", |
858 | NULL); | 857 | NULL); |
859 | total_packets = TOTAL_PACKETS; | 858 | total_packets = TOTAL_PACKETS; |
860 | short_time = SHORT_TIME; | 859 | short_time = SHORT_TIME; |
861 | if (-1 == GNUNET_GETOPT_run (argv[0], | 860 | if (-1 == GNUNET_GETOPT_run(argv[0], |
862 | options, | 861 | options, |
863 | argc, | 862 | argc, |
864 | argv)) | 863 | argv)) |
865 | { | 864 | { |
866 | fprintf (stderr, | 865 | fprintf(stderr, |
867 | "test failed: problem with CLI parameters\n"); | 866 | "test failed: problem with CLI parameters\n"); |
868 | return 1; | 867 | return 1; |
869 | } | 868 | } |
870 | GNUNET_CRYPTO_hash (port_id, | 869 | GNUNET_CRYPTO_hash(port_id, |
871 | sizeof (port_id), | 870 | sizeof(port_id), |
872 | &port); | 871 | &port); |
873 | ports[0] = &port; | 872 | ports[0] = &port; |
874 | ports[1] = NULL; | 873 | ports[1] = NULL; |
875 | GNUNET_CADET_TEST_ruN ("test_cadet_flow", | 874 | GNUNET_CADET_TEST_ruN("test_cadet_flow", |
876 | config_file, | 875 | config_file, |
877 | peers_requested, | 876 | peers_requested, |
878 | &tmain, | 877 | &tmain, |
879 | NULL, /* tmain cls */ | 878 | NULL, /* tmain cls */ |
880 | &connect_handler, | 879 | &connect_handler, |
881 | NULL, | 880 | NULL, |
882 | &disconnect_handler, | 881 | &disconnect_handler, |
883 | handlers, | 882 | handlers, |
884 | ports); | 883 | ports); |
885 | return 0; | 884 | return 0; |
886 | } | 885 | } |
887 | 886 | ||