diff options
27 files changed, 275 insertions, 229 deletions
diff --git a/src/include/gnunet_testing_netjail_lib.h b/src/include/gnunet_testing_netjail_lib.h index 106d7cdae..1d6f114eb 100644 --- a/src/include/gnunet_testing_netjail_lib.h +++ b/src/include/gnunet_testing_netjail_lib.h | |||
@@ -515,10 +515,10 @@ GNUNET_TESTING_cmd_local_test_prepared (const char *label, | |||
515 | */ | 515 | */ |
516 | #define GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS(op) \ | 516 | #define GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS(op) \ |
517 | op (test_system, const struct GNUNET_TESTING_System) \ | 517 | op (test_system, const struct GNUNET_TESTING_System) \ |
518 | op (async_context, const struct GNUNET_TESTING_AsyncContext) \ | 518 | op (async_context, struct GNUNET_TESTING_AsyncContext) \ |
519 | op (helper_handles, const struct GNUNET_HELPER_Handle *) \ | 519 | op (helper_handles, const struct GNUNET_HELPER_Handle *) \ |
520 | op (local_prepared_state, const struct GNUNET_TESTING_LocalPreparedState) \ | 520 | op (local_prepared_state, const struct GNUNET_TESTING_LocalPreparedState) \ |
521 | op (block_state, const struct GNUNET_TESTING_BlockState) | 521 | op (block_state, struct GNUNET_TESTING_BlockState) |
522 | 522 | ||
523 | GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT) | 523 | GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT) |
524 | 524 | ||
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h index 71d352643..5c9079fdf 100644 --- a/src/include/gnunet_testing_ng_lib.h +++ b/src/include/gnunet_testing_ng_lib.h | |||
@@ -70,7 +70,7 @@ struct GNUNET_TESTING_AsyncContext | |||
70 | /** | 70 | /** |
71 | * Interpreter we are part of. | 71 | * Interpreter we are part of. |
72 | */ | 72 | */ |
73 | struct GNUNET_TESTING_Interpreter *is; | 73 | struct GNUNET_TESTING_Interpreter *is; // Why needed? When available? |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Function to call when done. | 76 | * Function to call when done. |
@@ -90,14 +90,17 @@ struct GNUNET_TESTING_AsyncContext | |||
90 | enum GNUNET_GenericReturnValue finished; | 90 | enum GNUNET_GenericReturnValue finished; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | |||
93 | typedef void | 94 | typedef void |
94 | (*GNUNET_TESTING_CommandRunRoutine)(void *cls, | 95 | (*GNUNET_TESTING_CommandRunRoutine)(void *cls, |
95 | struct GNUNET_TESTING_Interpreter *is); | 96 | struct GNUNET_TESTING_Interpreter *is); |
96 | 97 | ||
98 | |||
97 | typedef void | 99 | typedef void |
98 | (*GNUNET_TESTING_CommandCleanupRoutine)(void *cls); | 100 | (*GNUNET_TESTING_CommandCleanupRoutine)(void *cls); |
99 | 101 | ||
100 | typedef enum GNUNET_GenericReturnValue | 102 | |
103 | typedef enum GNUNET_GenericReturnValue | ||
101 | (*GNUNET_TESTING_CommandGetTraits) (void *cls, | 104 | (*GNUNET_TESTING_CommandGetTraits) (void *cls, |
102 | const void **ret, | 105 | const void **ret, |
103 | const char *trait, | 106 | const char *trait, |
@@ -240,6 +243,7 @@ struct GNUNET_TESTING_Command | |||
240 | * @param label label of the command to lookup. | 243 | * @param label label of the command to lookup. |
241 | * @return the command, if it is found, or NULL. | 244 | * @return the command, if it is found, or NULL. |
242 | */ | 245 | */ |
246 | // FIXME: think harder about whether this is actually needed, likely not. | ||
243 | const struct GNUNET_TESTING_Command * | 247 | const struct GNUNET_TESTING_Command * |
244 | GNUNET_TESTING_interpreter_lookup_future_command ( | 248 | GNUNET_TESTING_interpreter_lookup_future_command ( |
245 | struct GNUNET_TESTING_Interpreter *is, | 249 | struct GNUNET_TESTING_Interpreter *is, |
@@ -321,10 +325,13 @@ GNUNET_TESTING_cmd_end (void); | |||
321 | 325 | ||
322 | 326 | ||
323 | /** | 327 | /** |
324 | * Turn asynchronous command into non blocking command by setting asynchronous_finish to true. | 328 | * Turn asynchronous command into non blocking command by setting |
325 | * FIXME: what is this API doing? Is it returning a new cmd which is unblocking? | 329 | * asynchronous_finish to true. Modifies (and then returns) @a cmd simply |
326 | * Is it modifying cmd? | 330 | * setting the bit. By default, most commands are blocking, and by wrapping |
327 | * Looking at the code, it both modifying cmd AND returning a copy oO | 331 | * the command construction in this function a blocking command can be turned |
332 | * into an asynchronous command where the interpreter continues after | ||
333 | * initiating the asynchronous action. Does nothing if the command is | ||
334 | * fundamentally synchronous. | ||
328 | * | 335 | * |
329 | * @param cmd command to make synchronous. | 336 | * @param cmd command to make synchronous. |
330 | * @return a finish-command. | 337 | * @return a finish-command. |
diff --git a/src/testing/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c index de50aca3a..4428d4402 100644 --- a/src/testing/gnunet-cmds-helper.c +++ b/src/testing/gnunet-cmds-helper.c | |||
@@ -69,8 +69,8 @@ | |||
69 | * if the start script was not started from within a new namespace | 69 | * if the start script was not started from within a new namespace |
70 | * created by unshare. The UPNP test case needs public IP | 70 | * created by unshare. The UPNP test case needs public IP |
71 | * addresse for miniupnpd to function. | 71 | * addresse for miniupnpd to function. |
72 | * FIXME We should introduce a switch indicating if public | 72 | * FIXME We should introduce a switch indicating if public |
73 | * addresses should be used or not. This info has to be | 73 | * addresses should be used or not. This info has to be |
74 | * propagated from the start script to the c code. | 74 | * propagated from the start script to the c code. |
75 | #define KNOWN_BASE_IP "172.16.151." | 75 | #define KNOWN_BASE_IP "172.16.151." |
76 | 76 | ||
@@ -276,7 +276,8 @@ write_task (void *cls) | |||
276 | * | 276 | * |
277 | */ | 277 | */ |
278 | static void | 278 | static void |
279 | write_message (struct GNUNET_MessageHeader *message, size_t msg_length) | 279 | write_message (struct GNUNET_MessageHeader *message, |
280 | size_t msg_length) | ||
280 | { | 281 | { |
281 | struct WriteContext *wc; | 282 | struct WriteContext *wc; |
282 | 283 | ||
@@ -292,6 +293,7 @@ write_message (struct GNUNET_MessageHeader *message, size_t msg_length) | |||
292 | wc); | 293 | wc); |
293 | } | 294 | } |
294 | 295 | ||
296 | |||
295 | static void | 297 | static void |
296 | delay_shutdown_cb () | 298 | delay_shutdown_cb () |
297 | { | 299 | { |
@@ -333,11 +335,11 @@ finished_cb (enum GNUNET_GenericReturnValue rv) | |||
333 | write_message ((struct GNUNET_MessageHeader *) reply, msg_length); | 335 | write_message ((struct GNUNET_MessageHeader *) reply, msg_length); |
334 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 336 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
335 | "message send\n"); | 337 | "message send\n"); |
336 | 338 | // FIXME: bad hack, do not write 1s, have continuation after write_message() is done! | |
337 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 339 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
338 | "delaying shutdown\n"); | 340 | "delaying shutdown\n"); |
339 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 341 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
340 | delay_shutdown_cb, | 342 | &delay_shutdown_cb, |
341 | NULL); | 343 | NULL); |
342 | } | 344 | } |
343 | 345 | ||
@@ -354,10 +356,10 @@ finished_cb (enum GNUNET_GenericReturnValue rv) | |||
354 | * #GNUNET_NO to stop further processing (no error) | 356 | * #GNUNET_NO to stop further processing (no error) |
355 | * #GNUNET_SYSERR to stop further processing with error | 357 | * #GNUNET_SYSERR to stop further processing with error |
356 | */ | 358 | */ |
357 | static int | 359 | static enum GNUNET_GenericReturnValue |
358 | tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) | 360 | tokenizer_cb (void *cls, |
361 | const struct GNUNET_MessageHeader *message) | ||
359 | { | 362 | { |
360 | |||
361 | struct NodeIdentifier *ni = cls; | 363 | struct NodeIdentifier *ni = cls; |
362 | const struct GNUNET_TESTING_CommandHelperInit *msg; | 364 | const struct GNUNET_TESTING_CommandHelperInit *msg; |
363 | struct GNUNET_TESTING_CommandHelperReply *reply; | 365 | struct GNUNET_TESTING_CommandHelperReply *reply; |
@@ -377,114 +379,130 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) | |||
377 | "Received message type %u and size %u\n", | 379 | "Received message type %u and size %u\n", |
378 | type, | 380 | type, |
379 | msize); | 381 | msize); |
380 | if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT == ntohs (message->type)) | 382 | switch (type) |
381 | { | 383 | { |
382 | msg = (const struct GNUNET_TESTING_CommandHelperInit *) message; | 384 | case GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT: |
383 | plugin_name_size = ntohs (msg->plugin_name_size); | ||
384 | if ((sizeof(struct GNUNET_TESTING_CommandHelperInit) + plugin_name_size) > msize) | ||
385 | { | 385 | { |
386 | GNUNET_break (0); | 386 | msg = (const struct GNUNET_TESTING_CommandHelperInit *) message; |
387 | LOG (GNUNET_ERROR_TYPE_WARNING, | 387 | plugin_name_size = ntohs (msg->plugin_name_size); |
388 | "Received unexpected message -- exiting\n"); | 388 | if ((sizeof(struct GNUNET_TESTING_CommandHelperInit) + plugin_name_size) > |
389 | goto error; | 389 | msize) |
390 | { | ||
391 | GNUNET_break (0); | ||
392 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
393 | "Received unexpected message -- exiting\n"); | ||
394 | goto error; | ||
395 | } | ||
396 | plugin_name = GNUNET_malloc (plugin_name_size + 1); | ||
397 | GNUNET_strlcpy (plugin_name, | ||
398 | ((char *) &msg[1]), | ||
399 | plugin_name_size + 1); | ||
400 | |||
401 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-cmd"); | ||
402 | |||
403 | plugin = GNUNET_new (struct TestcasePlugin); | ||
404 | plugin->api = GNUNET_PLUGIN_load (plugin_name, | ||
405 | NULL); | ||
406 | plugin->library_name = GNUNET_strdup (basename (plugin_name)); | ||
407 | |||
408 | plugin->global_n = ni->global_n; | ||
409 | plugin->local_m = ni->local_m; | ||
410 | plugin->n = ni->n; | ||
411 | plugin->m = ni->m; | ||
412 | |||
413 | GNUNET_asprintf (&router_ip, | ||
414 | ROUTER_BASE_IP "%s", | ||
415 | plugin->n); | ||
416 | { | ||
417 | char dummy; | ||
418 | |||
419 | if (1 != | ||
420 | sscanf (plugin->n, | ||
421 | "%u%c", | ||
422 | &namespace_n, | ||
423 | &dummy)) | ||
424 | { | ||
425 | // FIXME: how to handle error nicely? | ||
426 | GNUNET_break (0); | ||
427 | namespace_n = 0; | ||
428 | } | ||
429 | } | ||
430 | |||
431 | if (0 == namespace_n) | ||
432 | { | ||
433 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
434 | "known node n: %s\n", | ||
435 | plugin->n); | ||
436 | GNUNET_asprintf (&node_ip, | ||
437 | KNOWN_BASE_IP "%s", | ||
438 | plugin->m); | ||
439 | } | ||
440 | else | ||
441 | { | ||
442 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
443 | "subnet node n: %s\n", | ||
444 | plugin->n); | ||
445 | GNUNET_asprintf (&node_ip, | ||
446 | NODE_BASE_IP "%s", | ||
447 | plugin->m); | ||
448 | } | ||
449 | |||
450 | is = plugin->api->start_testcase (&write_message, | ||
451 | router_ip, | ||
452 | node_ip, | ||
453 | plugin->m, | ||
454 | plugin->n, | ||
455 | plugin->local_m, | ||
456 | ni->topology_data, | ||
457 | ni->read_file, | ||
458 | &finished_cb); | ||
459 | GNUNET_free (node_ip); | ||
460 | GNUNET_free (binary); | ||
461 | GNUNET_free (router_ip); | ||
462 | GNUNET_free (plugin_name); | ||
463 | |||
464 | msg_length = sizeof(struct GNUNET_TESTING_CommandHelperReply); | ||
465 | reply = GNUNET_new (struct GNUNET_TESTING_CommandHelperReply); | ||
466 | reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY); | ||
467 | reply->header.size = htons ((uint16_t) msg_length); | ||
468 | write_message (&reply->header, | ||
469 | msg_length); | ||
470 | return GNUNET_OK; | ||
390 | } | 471 | } |
391 | plugin_name = GNUNET_malloc (plugin_name_size + 1); | 472 | case GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE: |
392 | GNUNET_strlcpy (plugin_name, | ||
393 | ((char *) &msg[1]), | ||
394 | plugin_name_size + 1); | ||
395 | |||
396 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-cmd"); | ||
397 | |||
398 | plugin = GNUNET_new (struct TestcasePlugin); | ||
399 | plugin->api = GNUNET_PLUGIN_load (plugin_name, | ||
400 | NULL); | ||
401 | plugin->library_name = GNUNET_strdup (basename (plugin_name)); | ||
402 | |||
403 | plugin->global_n = ni->global_n; | ||
404 | plugin->local_m = ni->local_m; | ||
405 | plugin->n = ni->n; | ||
406 | plugin->m = ni->m; | ||
407 | |||
408 | router_ip = GNUNET_malloc (strlen (ROUTER_BASE_IP) + strlen (plugin->n) | ||
409 | + 1); | ||
410 | strcpy (router_ip, ROUTER_BASE_IP); | ||
411 | strcat (router_ip, plugin->n); | ||
412 | |||
413 | sscanf (plugin->n, "%u", &namespace_n); | ||
414 | |||
415 | if (0 == namespace_n) | ||
416 | { | 473 | { |
417 | LOG (GNUNET_ERROR_TYPE_ERROR, | 474 | const char *barrier_name; |
418 | "known node n: %s\n", | 475 | struct CommandBarrierCrossable *adm = (struct |
419 | plugin->n); | 476 | CommandBarrierCrossable *) message; |
420 | node_ip = GNUNET_malloc (strlen (KNOWN_BASE_IP) + strlen (plugin->m) + 1); | 477 | |
421 | strcat (node_ip, KNOWN_BASE_IP); | 478 | barrier_name = (const char *) &adm[1]; |
479 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
480 | "cross barrier %s\n", | ||
481 | barrier_name); | ||
482 | TST_interpreter_finish_attached_cmds (is, | ||
483 | barrier_name); | ||
484 | return GNUNET_OK; | ||
422 | } | 485 | } |
423 | else | 486 | case GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED: |
424 | { | 487 | { |
425 | LOG (GNUNET_ERROR_TYPE_ERROR, | 488 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
426 | "subnet node n: %s\n", | 489 | "all peers started\n"); |
427 | plugin->n); | 490 | plugin->api->all_peers_started (); |
428 | node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->m) + 1); | 491 | return GNUNET_OK; |
429 | strcat (node_ip, NODE_BASE_IP); | ||
430 | } | 492 | } |
431 | strcat (node_ip, plugin->m); | 493 | case GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_LOCAL_TESTS_PREPARED: |
432 | 494 | { | |
433 | is = plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m, | 495 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
434 | 496 | "all local tests prepared\n"); | |
435 | plugin->n, plugin->local_m, ni->topology_data, | 497 | plugin->api->all_local_tests_prepared (); |
436 | ni->read_file, &finished_cb); | 498 | return GNUNET_OK; |
437 | GNUNET_free (node_ip); | 499 | } |
438 | GNUNET_free (binary); | 500 | default: |
439 | GNUNET_free (router_ip); | ||
440 | GNUNET_free (plugin_name); | ||
441 | |||
442 | msg_length = sizeof(struct GNUNET_TESTING_CommandHelperReply); | ||
443 | reply = GNUNET_new (struct GNUNET_TESTING_CommandHelperReply); | ||
444 | reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY); | ||
445 | reply->header.size = htons ((uint16_t) msg_length); | ||
446 | |||
447 | write_message ((struct GNUNET_MessageHeader *) reply, msg_length); | ||
448 | |||
449 | return GNUNET_OK; | ||
450 | } | ||
451 | else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE == ntohs ( | ||
452 | message->type)) | ||
453 | { | ||
454 | const char *barrier_name; | ||
455 | struct CommandBarrierCrossable *adm = (struct CommandBarrierCrossable *) message; | ||
456 | |||
457 | barrier_name = (const char *) &adm[1]; | ||
458 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
459 | "cross barrier %s\n", | ||
460 | barrier_name); | ||
461 | TST_interpreter_finish_attached_cmds (is, barrier_name); | ||
462 | return GNUNET_OK; | ||
463 | } | ||
464 | else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED == ntohs ( | ||
465 | message->type)) | ||
466 | { | ||
467 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
468 | "all peers started\n"); | ||
469 | plugin->api->all_peers_started (); | ||
470 | return GNUNET_OK; | ||
471 | } | ||
472 | else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_LOCAL_TESTS_PREPARED == ntohs ( | ||
473 | message->type)) | ||
474 | { | ||
475 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
476 | "all local tests prepared\n"); | ||
477 | plugin->api->all_local_tests_prepared (); | ||
478 | return GNUNET_OK; | ||
479 | } | ||
480 | else | ||
481 | { | ||
482 | LOG (GNUNET_ERROR_TYPE_WARNING, "Received unexpected message -- exiting\n"); | 501 | LOG (GNUNET_ERROR_TYPE_WARNING, "Received unexpected message -- exiting\n"); |
483 | goto error; | 502 | goto error; |
484 | } | 503 | } |
485 | 504 | ||
486 | 505 | error: | |
487 | error: | ||
488 | status = GNUNET_SYSERR; | 506 | status = GNUNET_SYSERR; |
489 | LOG (GNUNET_ERROR_TYPE_ERROR, | 507 | LOG (GNUNET_ERROR_TYPE_ERROR, |
490 | "tokenizer shutting down!\n"); | 508 | "tokenizer shutting down!\n"); |
@@ -560,14 +578,16 @@ run (void *cls, | |||
560 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 578 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
561 | "Starting interpreter loop helper...\n"); | 579 | "Starting interpreter loop helper...\n"); |
562 | 580 | ||
563 | tokenizer = GNUNET_MST_create (&tokenizer_cb, ni); | 581 | tokenizer = GNUNET_MST_create (&tokenizer_cb, |
582 | ni); | ||
564 | stdin_fd = GNUNET_DISK_get_handle_from_native (stdin); | 583 | stdin_fd = GNUNET_DISK_get_handle_from_native (stdin); |
565 | stdout_fd = GNUNET_DISK_get_handle_from_native (stdout); | 584 | stdout_fd = GNUNET_DISK_get_handle_from_native (stdout); |
566 | read_task_id = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | 585 | read_task_id = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
567 | stdin_fd, | 586 | stdin_fd, |
568 | &read_task, | 587 | &read_task, |
569 | NULL); | 588 | NULL); |
570 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); | 589 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, |
590 | NULL); | ||
571 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 591 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
572 | "Interpreter loop helper started.\n"); | 592 | "Interpreter loop helper started.\n"); |
573 | } | 593 | } |
@@ -605,8 +625,9 @@ main (int argc, char **argv) | |||
605 | { | 625 | { |
606 | struct NodeIdentifier *ni; | 626 | struct NodeIdentifier *ni; |
607 | struct GNUNET_SIGNAL_Context *shc_chld; | 627 | struct GNUNET_SIGNAL_Context *shc_chld; |
608 | struct GNUNET_GETOPT_CommandLineOption options[] = | 628 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
609 | { GNUNET_GETOPT_OPTION_END }; | 629 | GNUNET_GETOPT_OPTION_END |
630 | }; | ||
610 | int ret; | 631 | int ret; |
611 | unsigned int sscanf_ret; | 632 | unsigned int sscanf_ret; |
612 | int i; | 633 | int i; |
@@ -667,8 +688,8 @@ main (int argc, char **argv) | |||
667 | return 1; | 688 | return 1; |
668 | } | 689 | } |
669 | shc_chld = | 690 | shc_chld = |
670 | GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); | 691 | GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, |
671 | 692 | &sighandler_child_death); | |
672 | ret = GNUNET_PROGRAM_run (argc, | 693 | ret = GNUNET_PROGRAM_run (argc, |
673 | argv, | 694 | argv, |
674 | "gnunet-cmds-helper", | 695 | "gnunet-cmds-helper", |
diff --git a/src/testing/testing_api_cmd_barrier.c b/src/testing/testing_api_cmd_barrier.c index 9dd154059..c9c43b178 100644 --- a/src/testing/testing_api_cmd_barrier.c +++ b/src/testing/testing_api_cmd_barrier.c | |||
@@ -130,6 +130,7 @@ barrier_traits (void *cls, | |||
130 | index); | 130 | index); |
131 | } | 131 | } |
132 | 132 | ||
133 | |||
133 | /** | 134 | /** |
134 | * Cleanup the state from a "barrier" CMD, and possibly | 135 | * Cleanup the state from a "barrier" CMD, and possibly |
135 | * cancel a pending operation thereof. | 136 | * cancel a pending operation thereof. |
@@ -144,6 +145,7 @@ barrier_cleanup (void *cls) | |||
144 | GNUNET_free (brs); | 145 | GNUNET_free (brs); |
145 | } | 146 | } |
146 | 147 | ||
148 | |||
147 | /** | 149 | /** |
148 | * Run the command. | 150 | * Run the command. |
149 | * | 151 | * |
@@ -159,6 +161,7 @@ barrier_run (void *cls, | |||
159 | TST_interpreter_add_barrier (is, brs->barrier); | 161 | TST_interpreter_add_barrier (is, brs->barrier); |
160 | } | 162 | } |
161 | 163 | ||
164 | |||
162 | struct GNUNET_TESTING_NetjailNode * | 165 | struct GNUNET_TESTING_NetjailNode * |
163 | GNUNET_TESTING_barrier_get_node (struct GNUNET_TESTING_Barrier *barrier, | 166 | GNUNET_TESTING_barrier_get_node (struct GNUNET_TESTING_Barrier *barrier, |
164 | unsigned int node_number) | 167 | unsigned int node_number) |
diff --git a/src/testing/testing_api_cmd_barrier_reached.c b/src/testing/testing_api_cmd_barrier_reached.c index 3c2ba3a1d..0075f8ef0 100644 --- a/src/testing/testing_api_cmd_barrier_reached.c +++ b/src/testing/testing_api_cmd_barrier_reached.c | |||
@@ -92,7 +92,8 @@ barrier_reached_run (void *cls, | |||
92 | { | 92 | { |
93 | struct BarrierReachedState *brs = cls; | 93 | struct BarrierReachedState *brs = cls; |
94 | struct GNUNET_TESTING_Barrier *barrier; | 94 | struct GNUNET_TESTING_Barrier *barrier; |
95 | struct GNUNET_TESTING_Command *cmd = GNUNET_TESTING_interpreter_get_current_command (is); | 95 | struct GNUNET_TESTING_Command *cmd = |
96 | GNUNET_TESTING_interpreter_get_current_command (is); | ||
96 | struct CommandListEntry *cle; | 97 | struct CommandListEntry *cle; |
97 | size_t msg_length; | 98 | size_t msg_length; |
98 | struct GNUNET_TESTING_CommandBarrierReached *msg; | 99 | struct GNUNET_TESTING_CommandBarrierReached *msg; |
@@ -105,8 +106,8 @@ barrier_reached_run (void *cls, | |||
105 | barrier->name = brs->barrier_name; | 106 | barrier->name = brs->barrier_name; |
106 | TST_interpreter_add_barrier (is, barrier); | 107 | TST_interpreter_add_barrier (is, barrier); |
107 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 108 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
108 | "barrier %s added locally\n", | 109 | "barrier %s added locally\n", |
109 | brs->barrier_name); | 110 | brs->barrier_name); |
110 | } | 111 | } |
111 | barrier->reached++; | 112 | barrier->reached++; |
112 | if (GNUNET_TESTING_barrier_crossable (barrier)) | 113 | if (GNUNET_TESTING_barrier_crossable (barrier)) |
@@ -133,13 +134,14 @@ barrier_reached_run (void *cls, | |||
133 | char *terminator = "\0"; | 134 | char *terminator = "\0"; |
134 | 135 | ||
135 | name_len = strlen (barrier->name); | 136 | name_len = strlen (barrier->name); |
136 | msg_length = sizeof(struct GNUNET_TESTING_CommandBarrierReached) + name_len + 1; | 137 | msg_length = sizeof(struct GNUNET_TESTING_CommandBarrierReached) |
138 | + name_len + 1; | ||
137 | msg = GNUNET_malloc (msg_length); | 139 | msg = GNUNET_malloc (msg_length); |
138 | msg->header.size = htons ((uint16_t) msg_length); | 140 | msg->header.size = htons ((uint16_t) msg_length); |
139 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED); | 141 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED); |
140 | msg->node_number = brs->node_number; | 142 | msg->node_number = brs->node_number; |
141 | memcpy (&msg[1], barrier->name, name_len + 1); | 143 | memcpy (&msg[1], barrier->name, name_len + 1); |
142 | memcpy(&msg[name_len + 1],terminator,1); | 144 | memcpy (&msg[name_len + 1],terminator,1); |
143 | brs->write_message ((struct GNUNET_MessageHeader *) msg, msg_length); | 145 | brs->write_message ((struct GNUNET_MessageHeader *) msg, msg_length); |
144 | } | 146 | } |
145 | } | 147 | } |
diff --git a/src/testing/testing_api_cmd_block_until_external_trigger.c b/src/testing/testing_api_cmd_block_until_external_trigger.c index 81a43a3ac..58f095842 100644 --- a/src/testing/testing_api_cmd_block_until_external_trigger.c +++ b/src/testing/testing_api_cmd_block_until_external_trigger.c | |||
@@ -48,6 +48,7 @@ block_until_all_peers_started_cleanup (void *cls) | |||
48 | GNUNET_free (bs); | 48 | GNUNET_free (bs); |
49 | } | 49 | } |
50 | 50 | ||
51 | |||
51 | static int | 52 | static int |
52 | block_until_external_trigger_traits (void *cls, | 53 | block_until_external_trigger_traits (void *cls, |
53 | const void **ret, | 54 | const void **ret, |
diff --git a/src/testing/testing_api_cmd_netjail_start_cmds_helper.c b/src/testing/testing_api_cmd_netjail_start_cmds_helper.c index f1ef9fef1..51a20dd9b 100644 --- a/src/testing/testing_api_cmd_netjail_start_cmds_helper.c +++ b/src/testing/testing_api_cmd_netjail_start_cmds_helper.c | |||
@@ -293,7 +293,6 @@ send_message_to_locals ( | |||
293 | helper = ns->helper[count - 1]; | 293 | helper = ns->helper[count - 1]; |
294 | 294 | ||
295 | 295 | ||
296 | |||
297 | struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send ( | 296 | struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send ( |
298 | (struct GNUNET_HELPER_Handle *) helper, | 297 | (struct GNUNET_HELPER_Handle *) helper, |
299 | header, | 298 | header, |
@@ -385,7 +384,7 @@ barrier_reached (struct NetJailState *ns, const struct | |||
385 | *) message; | 384 | *) message; |
386 | 385 | ||
387 | barrier_name = (const char *) &rm[1]; | 386 | barrier_name = (const char *) &rm[1]; |
388 | 387 | ||
389 | barrier = TST_interpreter_get_barrier (ns->is, barrier_name); | 388 | barrier = TST_interpreter_get_barrier (ns->is, barrier_name); |
390 | GNUNET_assert (NULL != barrier); | 389 | GNUNET_assert (NULL != barrier); |
391 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 390 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -396,13 +395,13 @@ barrier_reached (struct NetJailState *ns, const struct | |||
396 | barrier->reached++; | 395 | barrier->reached++; |
397 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 396 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
398 | "%u %p\n", | 397 | "%u %p\n", |
399 | barrier->reached, | 398 | barrier->reached, |
400 | barrier); | 399 | barrier); |
401 | if (GNUNET_TESTING_barrier_crossable (barrier)) | 400 | if (GNUNET_TESTING_barrier_crossable (barrier)) |
402 | { | 401 | { |
403 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 402 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
404 | "%s can be crossed\n", | 403 | "%s can be crossed\n", |
405 | barrier_name); | 404 | barrier_name); |
406 | TST_interpreter_finish_attached_cmds (ns->is, barrier->name); | 405 | TST_interpreter_finish_attached_cmds (ns->is, barrier->name); |
407 | } | 406 | } |
408 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 407 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -485,7 +484,8 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message) | |||
485 | if (GNUNET_OK != lf->rv) | 484 | if (GNUNET_OK != lf->rv) |
486 | { | 485 | { |
487 | GNUNET_TESTING_async_fail (&(ns->ac)); | 486 | GNUNET_TESTING_async_fail (&(ns->ac)); |
488 | } else if (ns->number_of_local_tests_finished == total_number) | 487 | } |
488 | else if (ns->number_of_local_tests_finished == total_number) | ||
489 | { | 489 | { |
490 | GNUNET_SCHEDULER_cancel (ns->timeout_task); | 490 | GNUNET_SCHEDULER_cancel (ns->timeout_task); |
491 | ns->timeout_task = NULL; | 491 | ns->timeout_task = NULL; |
@@ -509,8 +509,6 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message) | |||
509 | ns->known); | 509 | ns->known); |
510 | 510 | ||
511 | 511 | ||
512 | |||
513 | |||
514 | return GNUNET_OK; | 512 | return GNUNET_OK; |
515 | } | 513 | } |
516 | 514 | ||
@@ -737,22 +735,22 @@ start_helper (struct NetJailState *ns, | |||
737 | if (NULL == barrier) | 735 | if (NULL == barrier) |
738 | { | 736 | { |
739 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 737 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
740 | "barrier %s added\n", | 738 | "barrier %s added\n", |
741 | pos->barrier_name); | 739 | pos->barrier_name); |
742 | barrier = GNUNET_new (struct GNUNET_TESTING_Barrier); | 740 | barrier = GNUNET_new (struct GNUNET_TESTING_Barrier); |
743 | barrier->name = pos->barrier_name; | 741 | barrier->name = pos->barrier_name; |
744 | barrier->shadow = GNUNET_YES; | 742 | barrier->shadow = GNUNET_YES; |
745 | TST_interpreter_add_barrier (ns->is, barrier); | 743 | TST_interpreter_add_barrier (ns->is, barrier); |
746 | 744 | ||
747 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 745 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
748 | "%u %p\n", | 746 | "%u %p\n", |
749 | barrier->reached, | 747 | barrier->reached, |
750 | barrier); | 748 | barrier); |
751 | 749 | ||
752 | barrier->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | 750 | barrier->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); |
753 | } | 751 | } |
754 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 752 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
755 | "barrier %p %s node %u added \n", | 753 | "barrier %p %s node %u added \n", |
756 | barrier, | 754 | barrier, |
757 | pos->barrier_name, | 755 | pos->barrier_name, |
758 | node->node_number); | 756 | node->node_number); |
@@ -859,7 +857,7 @@ netjail_exec_run (void *cls, | |||
859 | for (int j = 1; j <= ns->local_m; j++) | 857 | for (int j = 1; j <= ns->local_m; j++) |
860 | { | 858 | { |
861 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 859 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
862 | "i %u j %u\n", | 860 | "i %u j %u\n", |
863 | i, | 861 | i, |
864 | j); | 862 | j); |
865 | start_helper (ns, | 863 | start_helper (ns, |
diff --git a/src/testing/testing_api_cmd_send_peer_ready.c b/src/testing/testing_api_cmd_send_peer_ready.c index dcd69e595..f615a1cee 100644 --- a/src/testing/testing_api_cmd_send_peer_ready.c +++ b/src/testing/testing_api_cmd_send_peer_ready.c | |||
@@ -109,7 +109,8 @@ send_peer_ready_run (void *cls, | |||
109 | */ | 109 | */ |
110 | struct GNUNET_TESTING_Command | 110 | struct GNUNET_TESTING_Command |
111 | GNUNET_TESTING_cmd_send_peer_ready (const char *label, | 111 | GNUNET_TESTING_cmd_send_peer_ready (const char *label, |
112 | GNUNET_TESTING_cmd_helper_write_cb write_message) | 112 | GNUNET_TESTING_cmd_helper_write_cb |
113 | write_message) | ||
113 | { | 114 | { |
114 | struct SendPeerReadyState *sprs; | 115 | struct SendPeerReadyState *sprs; |
115 | 116 | ||
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c index e34f87cc2..db0a00c22 100644 --- a/src/testing/testing_api_loop.c +++ b/src/testing/testing_api_loop.c | |||
@@ -123,7 +123,7 @@ struct FreeBarrierNodeCbCls | |||
123 | }; | 123 | }; |
124 | 124 | ||
125 | 125 | ||
126 | const struct GNUNET_TESTING_Command * | 126 | static const struct GNUNET_TESTING_Command * |
127 | get_command (struct GNUNET_TESTING_Interpreter *is, | 127 | get_command (struct GNUNET_TESTING_Interpreter *is, |
128 | const char *label, | 128 | const char *label, |
129 | unsigned int future) | 129 | unsigned int future) |
@@ -265,7 +265,7 @@ free_barrier_node_cb (void *cls, | |||
265 | } | 265 | } |
266 | 266 | ||
267 | 267 | ||
268 | int | 268 | static int |
269 | free_barriers_cb (void *cls, | 269 | free_barriers_cb (void *cls, |
270 | const struct GNUNET_ShortHashCode *key, | 270 | const struct GNUNET_ShortHashCode *key, |
271 | void *value) | 271 | void *value) |
@@ -574,14 +574,19 @@ GNUNET_TESTING_run (const struct GNUNET_TESTING_Command *commands, | |||
574 | is = GNUNET_new (struct GNUNET_TESTING_Interpreter); | 574 | is = GNUNET_new (struct GNUNET_TESTING_Interpreter); |
575 | is->rc = rc; | 575 | is->rc = rc; |
576 | is->rc_cls = rc_cls; | 576 | is->rc_cls = rc_cls; |
577 | is->barriers = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | 577 | is->barriers = GNUNET_CONTAINER_multishortmap_create (1, |
578 | false); | ||
578 | /* get the number of commands */ | 579 | /* get the number of commands */ |
579 | for (i = 0; NULL != commands[i].run; i++) | 580 | for (i = 0; NULL != commands[i].run; i++) |
580 | ; | 581 | ; |
581 | is->cmds_n = i + 1; | 582 | is->cmds_n = i + 1; |
582 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got %u commands\n", i); | 583 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
583 | is->commands = GNUNET_new_array (is->cmds_n, | 584 | "Got %u commands\n", |
584 | struct GNUNET_TESTING_Command); | 585 | i); |
586 | is->commands = GNUNET_malloc_large ( (i + 1) | ||
587 | * sizeof (struct | ||
588 | GNUNET_TESTING_Command)); | ||
589 | GNUNET_assert (NULL != is->commands); | ||
585 | memcpy (is->commands, | 590 | memcpy (is->commands, |
586 | commands, | 591 | commands, |
587 | sizeof (struct GNUNET_TESTING_Command) * i); | 592 | sizeof (struct GNUNET_TESTING_Command) * i); |
@@ -701,9 +706,9 @@ loop_run (void *cls) | |||
701 | * Continuation function from GNUNET_HELPER_send() | 706 | * Continuation function from GNUNET_HELPER_send() |
702 | * | 707 | * |
703 | * @param cls closure | 708 | * @param cls closure |
704 | * @param result GNUNET_OK on success, | 709 | * @param result #GNUNET_OK on success, |
705 | * GNUNET_NO if helper process died | 710 | * #GNUNET_NO if helper process died |
706 | * GNUNET_SYSERR during GNUNET_HELPER_stop | 711 | * #GNUNET_SYSERR during GNUNET_HELPER_stop() |
707 | */ | 712 | */ |
708 | static void | 713 | static void |
709 | clear_msg (void *cls, int result) | 714 | clear_msg (void *cls, int result) |
@@ -761,7 +766,6 @@ TST_interpreter_send_barrier_crossable (struct GNUNET_TESTING_Interpreter *is, | |||
761 | struct CommandBarrierCrossable *adm; | 766 | struct CommandBarrierCrossable *adm; |
762 | size_t msg_length; | 767 | size_t msg_length; |
763 | size_t name_len; | 768 | size_t name_len; |
764 | char *terminator = "\0"; | ||
765 | 769 | ||
766 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 770 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
767 | "send barrier name %s barrier_name\n", | 771 | "send barrier name %s barrier_name\n", |
@@ -813,7 +817,6 @@ TST_interpreter_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is, | |||
813 | const char *barrier_name) | 817 | const char *barrier_name) |
814 | { | 818 | { |
815 | struct CommandListEntry *pos; | 819 | struct CommandListEntry *pos; |
816 | struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls; | ||
817 | struct GNUNET_TESTING_Barrier *barrier = TST_interpreter_get_barrier (is, | 820 | struct GNUNET_TESTING_Barrier *barrier = TST_interpreter_get_barrier (is, |
818 | barrier_name); | 821 | barrier_name); |
819 | 822 | ||
@@ -846,17 +849,18 @@ TST_interpreter_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is, | |||
846 | } | 849 | } |
847 | if (NULL != barrier->nodes) | 850 | if (NULL != barrier->nodes) |
848 | { | 851 | { |
849 | free_barrier_node_cb_cls = GNUNET_new (struct FreeBarrierNodeCbCls); | 852 | struct FreeBarrierNodeCbCls free_barrier_node_cb_cls = { |
850 | free_barrier_node_cb_cls->barrier = barrier; | 853 | .barrier = barrier, |
851 | free_barrier_node_cb_cls->is = is; | 854 | .is = is |
855 | }; | ||
856 | |||
852 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 857 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
853 | "freeing nodes\n"); | 858 | "freeing nodes\n"); |
854 | GNUNET_CONTAINER_multishortmap_iterate (barrier->nodes, | 859 | GNUNET_CONTAINER_multishortmap_iterate (barrier->nodes, |
855 | free_barrier_node_cb, | 860 | &free_barrier_node_cb, |
856 | free_barrier_node_cb_cls); | 861 | &free_barrier_node_cb_cls); |
857 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 862 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
858 | "nodes freed\n"); | 863 | "nodes freed\n"); |
859 | GNUNET_free (free_barrier_node_cb_cls); | ||
860 | GNUNET_CONTAINER_multishortmap_destroy (barrier->nodes); | 864 | GNUNET_CONTAINER_multishortmap_destroy (barrier->nodes); |
861 | barrier->nodes = NULL; | 865 | barrier->nodes = NULL; |
862 | } | 866 | } |
diff --git a/src/transport/gnunet-communicator-quic.c b/src/transport/gnunet-communicator-quic.c index 700fd0ca4..76b0ebd62 100644 --- a/src/transport/gnunet-communicator-quic.c +++ b/src/transport/gnunet-communicator-quic.c | |||
@@ -21,9 +21,9 @@ | |||
21 | /* Currently equivalent to QUICHE_MAX_CONN_ID_LEN */ | 21 | /* Currently equivalent to QUICHE_MAX_CONN_ID_LEN */ |
22 | #define LOCAL_CONN_ID_LEN 20 | 22 | #define LOCAL_CONN_ID_LEN 20 |
23 | #define MAX_TOKEN_LEN \ | 23 | #define MAX_TOKEN_LEN \ |
24 | sizeof("quiche") - 1 + \ | 24 | sizeof("quiche") - 1 \ |
25 | sizeof(struct sockaddr_storage) + \ | 25 | + sizeof(struct sockaddr_storage) \ |
26 | QUICHE_MAX_CONN_ID_LEN | 26 | + QUICHE_MAX_CONN_ID_LEN |
27 | #define CID_LEN sizeof(uint8_t) * QUICHE_MAX_CONN_ID_LEN | 27 | #define CID_LEN sizeof(uint8_t) * QUICHE_MAX_CONN_ID_LEN |
28 | #define TOKEN_LEN sizeof(uint8_t) * MAX_TOKEN_LEN | 28 | #define TOKEN_LEN sizeof(uint8_t) * MAX_TOKEN_LEN |
29 | /* Generic, bidirectional, client-initiated quic stream id */ | 29 | /* Generic, bidirectional, client-initiated quic stream id */ |
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index d8d37bbb7..faacb3aab 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c | |||
@@ -52,7 +52,7 @@ | |||
52 | * the other peer should revalidate). | 52 | * the other peer should revalidate). |
53 | */ | 53 | */ |
54 | #define ADDRESS_VALIDITY_PERIOD \ | 54 | #define ADDRESS_VALIDITY_PERIOD \ |
55 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) | 55 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * How many messages do we keep at most in the queue to the | 58 | * How many messages do we keep at most in the queue to the |
@@ -91,16 +91,16 @@ | |||
91 | * directions. | 91 | * directions. |
92 | */ | 92 | */ |
93 | #define INITIAL_KX_SIZE \ | 93 | #define INITIAL_KX_SIZE \ |
94 | (sizeof(struct GNUNET_CRYPTO_EcdhePublicKey) \ | 94 | (sizeof(struct GNUNET_CRYPTO_EcdhePublicKey) \ |
95 | + sizeof(struct TCPConfirmation)) | 95 | + sizeof(struct TCPConfirmation)) |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Size of the initial core key exchange messages. | 98 | * Size of the initial core key exchange messages. |
99 | */ | 99 | */ |
100 | #define INITIAL_CORE_KX_SIZE \ | 100 | #define INITIAL_CORE_KX_SIZE \ |
101 | (sizeof(struct EphemeralKeyMessage) \ | 101 | (sizeof(struct EphemeralKeyMessage) \ |
102 | + sizeof(struct PingMessage) \ | 102 | + sizeof(struct PingMessage) \ |
103 | + sizeof(struct PongMessage)) | 103 | + sizeof(struct PongMessage)) |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * Address prefix used by the communicator. | 106 | * Address prefix used by the communicator. |
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c index 50e66e13a..f5cf7ab0f 100644 --- a/src/transport/gnunet-communicator-udp.c +++ b/src/transport/gnunet-communicator-udp.c | |||
@@ -68,7 +68,7 @@ | |||
68 | * How often do we scan for changes to our network interfaces? | 68 | * How often do we scan for changes to our network interfaces? |
69 | */ | 69 | */ |
70 | #define INTERFACE_SCAN_FREQUENCY \ | 70 | #define INTERFACE_SCAN_FREQUENCY \ |
71 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | 71 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * How long do we believe our addresses to remain up (before | 74 | * How long do we believe our addresses to remain up (before |
@@ -77,7 +77,7 @@ | |||
77 | #define ADDRESS_VALIDITY_PERIOD GNUNET_TIME_UNIT_HOURS | 77 | #define ADDRESS_VALIDITY_PERIOD GNUNET_TIME_UNIT_HOURS |
78 | 78 | ||
79 | #define WORKING_QUEUE_INTERVALL \ | 79 | #define WORKING_QUEUE_INTERVALL \ |
80 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,1) | 80 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,1) |
81 | 81 | ||
82 | /** | 82 | /** |
83 | * AES key size. | 83 | * AES key size. |
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c index a008daff3..083db325e 100644 --- a/src/transport/gnunet-service-tng.c +++ b/src/transport/gnunet-service-tng.c | |||
@@ -186,20 +186,20 @@ | |||
186 | * the value chosen here might be too aggressively low! | 186 | * the value chosen here might be too aggressively low! |
187 | */ | 187 | */ |
188 | #define DELAY_WARN_THRESHOLD \ | 188 | #define DELAY_WARN_THRESHOLD \ |
189 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) | 189 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) |
190 | 190 | ||
191 | /** | 191 | /** |
192 | * If a DVBox could not be forwarded after this number of | 192 | * If a DVBox could not be forwarded after this number of |
193 | * seconds we drop it. | 193 | * seconds we drop it. |
194 | */ | 194 | */ |
195 | #define DV_FORWARD_TIMEOUT \ | 195 | #define DV_FORWARD_TIMEOUT \ |
196 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) | 196 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) |
197 | 197 | ||
198 | /** | 198 | /** |
199 | * Default value for how long we wait for reliability ack. | 199 | * Default value for how long we wait for reliability ack. |
200 | */ | 200 | */ |
201 | #define DEFAULT_ACK_WAIT_DURATION \ | 201 | #define DEFAULT_ACK_WAIT_DURATION \ |
202 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | 202 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) |
203 | 203 | ||
204 | /** | 204 | /** |
205 | * We only consider queues as "quality" connections when | 205 | * We only consider queues as "quality" connections when |
@@ -207,53 +207,53 @@ | |||
207 | * the latency of the queue is below this threshold. | 207 | * the latency of the queue is below this threshold. |
208 | */ | 208 | */ |
209 | #define DV_QUALITY_RTT_THRESHOLD \ | 209 | #define DV_QUALITY_RTT_THRESHOLD \ |
210 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | 210 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) |
211 | 211 | ||
212 | /** | 212 | /** |
213 | * How long do we consider a DV path valid if we see no | 213 | * How long do we consider a DV path valid if we see no |
214 | * further updates on it? Note: the value chosen here might be too low! | 214 | * further updates on it? Note: the value chosen here might be too low! |
215 | */ | 215 | */ |
216 | #define DV_PATH_VALIDITY_TIMEOUT \ | 216 | #define DV_PATH_VALIDITY_TIMEOUT \ |
217 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | 217 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) |
218 | 218 | ||
219 | /** | 219 | /** |
220 | * How long do we cache backchannel (struct Backtalker) information | 220 | * How long do we cache backchannel (struct Backtalker) information |
221 | * after a backchannel goes inactive? | 221 | * after a backchannel goes inactive? |
222 | */ | 222 | */ |
223 | #define BACKCHANNEL_INACTIVITY_TIMEOUT \ | 223 | #define BACKCHANNEL_INACTIVITY_TIMEOUT \ |
224 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | 224 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) |
225 | 225 | ||
226 | /** | 226 | /** |
227 | * How long before paths expire would we like to (re)discover DV paths? Should | 227 | * How long before paths expire would we like to (re)discover DV paths? Should |
228 | * be below #DV_PATH_VALIDITY_TIMEOUT. | 228 | * be below #DV_PATH_VALIDITY_TIMEOUT. |
229 | */ | 229 | */ |
230 | #define DV_PATH_DISCOVERY_FREQUENCY \ | 230 | #define DV_PATH_DISCOVERY_FREQUENCY \ |
231 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 4) | 231 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 4) |
232 | 232 | ||
233 | /** | 233 | /** |
234 | * How long are ephemeral keys valid? | 234 | * How long are ephemeral keys valid? |
235 | */ | 235 | */ |
236 | #define EPHEMERAL_VALIDITY \ | 236 | #define EPHEMERAL_VALIDITY \ |
237 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) | 237 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) |
238 | 238 | ||
239 | /** | 239 | /** |
240 | * How long do we keep partially reassembled messages around before giving up? | 240 | * How long do we keep partially reassembled messages around before giving up? |
241 | */ | 241 | */ |
242 | #define REASSEMBLY_EXPIRATION \ | 242 | #define REASSEMBLY_EXPIRATION \ |
243 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 4) | 243 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 4) |
244 | 244 | ||
245 | /** | 245 | /** |
246 | * What is the fastest rate at which we send challenges *if* we keep learning | 246 | * What is the fastest rate at which we send challenges *if* we keep learning |
247 | * an address (gossip, DHT, etc.)? | 247 | * an address (gossip, DHT, etc.)? |
248 | */ | 248 | */ |
249 | #define FAST_VALIDATION_CHALLENGE_FREQ \ | 249 | #define FAST_VALIDATION_CHALLENGE_FREQ \ |
250 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1) | 250 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1) |
251 | 251 | ||
252 | /** | 252 | /** |
253 | * What is the slowest rate at which we send challenges? | 253 | * What is the slowest rate at which we send challenges? |
254 | */ | 254 | */ |
255 | #define MAX_VALIDATION_CHALLENGE_FREQ \ | 255 | #define MAX_VALIDATION_CHALLENGE_FREQ \ |
256 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_DAYS, 1) | 256 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_DAYS, 1) |
257 | 257 | ||
258 | /** | 258 | /** |
259 | * How long until we forget about historic accumulators and thus | 259 | * How long until we forget about historic accumulators and thus |
@@ -261,7 +261,7 @@ | |||
261 | * active connection experiences without an ACK. | 261 | * active connection experiences without an ACK. |
262 | */ | 262 | */ |
263 | #define ACK_CUMMULATOR_TIMEOUT \ | 263 | #define ACK_CUMMULATOR_TIMEOUT \ |
264 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) | 264 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) |
265 | 265 | ||
266 | /** | 266 | /** |
267 | * What is the non-randomized base frequency at which we | 267 | * What is the non-randomized base frequency at which we |
@@ -279,13 +279,13 @@ | |||
279 | * When do we forget an invalid address for sure? | 279 | * When do we forget an invalid address for sure? |
280 | */ | 280 | */ |
281 | #define MAX_ADDRESS_VALID_UNTIL \ | 281 | #define MAX_ADDRESS_VALID_UNTIL \ |
282 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MONTHS, 1) | 282 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MONTHS, 1) |
283 | 283 | ||
284 | /** | 284 | /** |
285 | * How long do we consider an address valid if we just checked? | 285 | * How long do we consider an address valid if we just checked? |
286 | */ | 286 | */ |
287 | #define ADDRESS_VALIDATION_LIFETIME \ | 287 | #define ADDRESS_VALIDATION_LIFETIME \ |
288 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) | 288 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) |
289 | 289 | ||
290 | /** | 290 | /** |
291 | * What is the maximum frequency at which we do address validation? | 291 | * What is the maximum frequency at which we do address validation? |
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c index 40353daeb..a033985e1 100644 --- a/src/transport/plugin_transport_http_common.c +++ b/src/transport/plugin_transport_http_common.c | |||
@@ -604,7 +604,7 @@ http_common_plugin_address_to_string (const char *plugin, | |||
604 | if (addr_str[ntohl (address->urlen) - 1] != '\0') | 604 | if (addr_str[ntohl (address->urlen) - 1] != '\0') |
605 | return NULL; | 605 | return NULL; |
606 | GNUNET_asprintf (&res, "%s.%u.%s", plugin, ntohl (address->options), | 606 | GNUNET_asprintf (&res, "%s.%u.%s", plugin, ntohl (address->options), |
607 | (char*)&address[1]); | 607 | (char*) &address[1]); |
608 | if (strlen (res) + 1 < 500) | 608 | if (strlen (res) + 1 < 500) |
609 | { | 609 | { |
610 | GNUNET_memcpy (rbuf, res, strlen (res) + 1); | 610 | GNUNET_memcpy (rbuf, res, strlen (res) + 1); |
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 138fb5080..3ac106859 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -1873,7 +1873,8 @@ handle_helper_message (void *cls, | |||
1873 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1873 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1874 | "Size of packet is too small (%llu bytes < %llu)\n", | 1874 | "Size of packet is too small (%llu bytes < %llu)\n", |
1875 | (unsigned long long) msize, | 1875 | (unsigned long long) msize, |
1876 | (unsigned long long) sizeof(struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)); | 1876 | (unsigned long long) sizeof(struct |
1877 | GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)); | ||
1877 | break; | 1878 | break; |
1878 | } | 1879 | } |
1879 | rxinfo = (const struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) hdr; | 1880 | rxinfo = (const struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) hdr; |
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c index 1658c2151..713275fd3 100644 --- a/src/transport/test_communicator_basic.c +++ b/src/transport/test_communicator_basic.c | |||
@@ -104,13 +104,13 @@ static unsigned int iterations_left[NUM_PEERS]; | |||
104 | #define TIMEOUT_MULTIPLIER 1 | 104 | #define TIMEOUT_MULTIPLIER 1 |
105 | 105 | ||
106 | #define DELAY \ | 106 | #define DELAY \ |
107 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,200) | 107 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,200) |
108 | 108 | ||
109 | #define SHORT_BURST_WINDOW \ | 109 | #define SHORT_BURST_WINDOW \ |
110 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2) | 110 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2) |
111 | 111 | ||
112 | #define LONG_BURST_WINDOW \ | 112 | #define LONG_BURST_WINDOW \ |
113 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2) | 113 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2) |
114 | 114 | ||
115 | enum TestPhase | 115 | enum TestPhase |
116 | { | 116 | { |
diff --git a/src/transport/test_transport_api2.c b/src/transport/test_transport_api2.c index e1606e0be..4d423f7c2 100644 --- a/src/transport/test_transport_api2.c +++ b/src/transport/test_transport_api2.c | |||
@@ -28,7 +28,7 @@ | |||
28 | * C code apparently. | 28 | * C code apparently. |
29 | */ | 29 | */ |
30 | #include "platform.h" | 30 | #include "platform.h" |
31 | //#include "gnunet_transport_service.h" | 31 | // #include "gnunet_transport_service.h" |
32 | #include "transport-testing2.h" | 32 | #include "transport-testing2.h" |
33 | 33 | ||
34 | /** | 34 | /** |
diff --git a/src/transport/test_transport_plugin_cmd_nat_upnp.c b/src/transport/test_transport_plugin_cmd_nat_upnp.c index 1b02fbfc2..bb1c2be0a 100644 --- a/src/transport/test_transport_plugin_cmd_nat_upnp.c +++ b/src/transport/test_transport_plugin_cmd_nat_upnp.c | |||
@@ -90,7 +90,7 @@ handle_test (void *cls, | |||
90 | struct GNUNET_TESTING_BarrierList* | 90 | struct GNUNET_TESTING_BarrierList* |
91 | get_waiting_for_barriers () | 91 | get_waiting_for_barriers () |
92 | { | 92 | { |
93 | struct GNUNET_TESTING_BarrierList* barriers; | 93 | struct GNUNET_TESTING_BarrierList*barriers; |
94 | struct GNUNET_TESTING_BarrierListEntry *ble; | 94 | struct GNUNET_TESTING_BarrierListEntry *ble; |
95 | 95 | ||
96 | barriers = GNUNET_new (struct GNUNET_TESTING_BarrierList); | 96 | barriers = GNUNET_new (struct GNUNET_TESTING_BarrierList); |
@@ -209,7 +209,7 @@ all_local_tests_prepared () | |||
209 | * the topology configuration. | 209 | * the topology configuration. |
210 | * @param read_file If read_file is GNUNET_YES this string is the filename for the topology configuration, | 210 | * @param read_file If read_file is GNUNET_YES this string is the filename for the topology configuration, |
211 | * if read_file is GNUNET_NO the string contains the topology configuration. | 211 | * if read_file is GNUNET_NO the string contains the topology configuration. |
212 | * @param finish_cb Callback function which writes a message from the helper process running on a netjail | 212 | * @param finish_cb Callback function which writes a message from the helper process running on a netjail |
213 | * node to the master process * signaling that the test case running on the netjail node finished. | 213 | * node to the master process * signaling that the test case running on the netjail node finished. |
214 | * @return Returns the struct GNUNET_TESTING_Interpreter of the command loop running on this netjail node. | 214 | * @return Returns the struct GNUNET_TESTING_Interpreter of the command loop running on this netjail node. |
215 | */ | 215 | */ |
@@ -357,9 +357,9 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | |||
357 | ts->write_message = write_message; | 357 | ts->write_message = write_message; |
358 | 358 | ||
359 | is = GNUNET_TESTING_run (commands, | 359 | is = GNUNET_TESTING_run (commands, |
360 | TIMEOUT, | 360 | TIMEOUT, |
361 | &handle_result, | 361 | &handle_result, |
362 | ts); | 362 | ts); |
363 | return is; | 363 | return is; |
364 | } | 364 | } |
365 | 365 | ||
diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c b/src/transport/test_transport_plugin_cmd_simple_send.c index 375796dff..8a96e19f9 100644 --- a/src/transport/test_transport_plugin_cmd_simple_send.c +++ b/src/transport/test_transport_plugin_cmd_simple_send.c | |||
@@ -90,7 +90,7 @@ handle_test (void *cls, | |||
90 | struct GNUNET_TESTING_BarrierList * | 90 | struct GNUNET_TESTING_BarrierList * |
91 | get_waiting_for_barriers () | 91 | get_waiting_for_barriers () |
92 | { | 92 | { |
93 | //No Barrier | 93 | // No Barrier |
94 | return GNUNET_new (struct GNUNET_TESTING_BarrierList); | 94 | return GNUNET_new (struct GNUNET_TESTING_BarrierList); |
95 | } | 95 | } |
96 | 96 | ||
@@ -326,9 +326,9 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | |||
326 | ts->write_message = write_message; | 326 | ts->write_message = write_message; |
327 | 327 | ||
328 | is = GNUNET_TESTING_run (commands, | 328 | is = GNUNET_TESTING_run (commands, |
329 | TIMEOUT, | 329 | TIMEOUT, |
330 | &handle_result, | 330 | &handle_result, |
331 | ts); | 331 | ts); |
332 | return is; | 332 | return is; |
333 | } | 333 | } |
334 | 334 | ||
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c b/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c index 7381b1d7e..7000851c4 100644 --- a/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c +++ b/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c | |||
@@ -90,7 +90,7 @@ handle_test (void *cls, | |||
90 | struct GNUNET_TESTING_BarrierList * | 90 | struct GNUNET_TESTING_BarrierList * |
91 | get_waiting_for_barriers () | 91 | get_waiting_for_barriers () |
92 | { | 92 | { |
93 | //No Barrier | 93 | // No Barrier |
94 | return GNUNET_new (struct GNUNET_TESTING_BarrierList); | 94 | return GNUNET_new (struct GNUNET_TESTING_BarrierList); |
95 | } | 95 | } |
96 | 96 | ||
@@ -147,12 +147,11 @@ static void * | |||
147 | notify_connect (struct GNUNET_TESTING_Interpreter *is, | 147 | notify_connect (struct GNUNET_TESTING_Interpreter *is, |
148 | const struct GNUNET_PeerIdentity *peer) | 148 | const struct GNUNET_PeerIdentity *peer) |
149 | { | 149 | { |
150 | const struct GNUNET_TESTING_AsyncContext *ac; | 150 | struct GNUNET_TESTING_AsyncContext *ac; |
151 | void *ret = NULL; | 151 | void *ret = NULL; |
152 | const struct GNUNET_TESTING_Command *cmd; | 152 | const struct GNUNET_TESTING_Command *cmd; |
153 | struct GNUNET_TESTING_BlockState *bs; | 153 | struct GNUNET_TESTING_BlockState *bs; |
154 | 154 | ||
155 | |||
156 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 155 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
157 | "notify_connect\n"); | 156 | "notify_connect\n"); |
158 | 157 | ||
@@ -165,9 +164,9 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is, | |||
165 | "notify_connect running\n"); | 164 | "notify_connect running\n"); |
166 | GNUNET_assert (NULL != ac); | 165 | GNUNET_assert (NULL != ac); |
167 | if (NULL == ac->cont) | 166 | if (NULL == ac->cont) |
168 | GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) ac); | 167 | GNUNET_TESTING_async_fail (ac); |
169 | else | 168 | else |
170 | GNUNET_TESTING_async_finish ((struct GNUNET_TESTING_AsyncContext *) ac); | 169 | GNUNET_TESTING_async_finish (ac); |
171 | } | 170 | } |
172 | else | 171 | else |
173 | { | 172 | { |
@@ -179,7 +178,7 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is, | |||
179 | cmd->label); | 178 | cmd->label); |
180 | GNUNET_TESTING_get_trait_block_state ( | 179 | GNUNET_TESTING_get_trait_block_state ( |
181 | cmd, | 180 | cmd, |
182 | (const struct GNUNET_TESTING_BlockState **) &bs); | 181 | &bs); |
183 | 182 | ||
184 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 183 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
185 | "block state %u\n", | 184 | "block state %u\n", |
@@ -353,9 +352,9 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | |||
353 | ts->write_message = write_message; | 352 | ts->write_message = write_message; |
354 | 353 | ||
355 | is = GNUNET_TESTING_run (commands, | 354 | is = GNUNET_TESTING_run (commands, |
356 | TIMEOUT, | 355 | TIMEOUT, |
357 | &handle_result, | 356 | &handle_result, |
358 | ts); | 357 | ts); |
359 | return is; | 358 | return is; |
360 | } | 359 | } |
361 | 360 | ||
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_dv.c b/src/transport/test_transport_plugin_cmd_simple_send_dv.c index 55ab4a48f..52174e539 100644 --- a/src/transport/test_transport_plugin_cmd_simple_send_dv.c +++ b/src/transport/test_transport_plugin_cmd_simple_send_dv.c | |||
@@ -113,7 +113,7 @@ handle_test (void *cls, | |||
113 | GNUNET_TESTING_get_trait_async_context (&block_receive, | 113 | GNUNET_TESTING_get_trait_async_context (&block_receive, |
114 | &ac_block); | 114 | &ac_block); |
115 | 115 | ||
116 | if ( connected == number_received) | 116 | if (connected == number_received) |
117 | { | 117 | { |
118 | if (NULL != ac_block->is) | 118 | if (NULL != ac_block->is) |
119 | { | 119 | { |
@@ -142,7 +142,7 @@ handle_test (void *cls, | |||
142 | struct GNUNET_TESTING_BarrierList * | 142 | struct GNUNET_TESTING_BarrierList * |
143 | get_waiting_for_barriers () | 143 | get_waiting_for_barriers () |
144 | { | 144 | { |
145 | //No Barrier | 145 | // No Barrier |
146 | return GNUNET_new (struct GNUNET_TESTING_BarrierList); | 146 | return GNUNET_new (struct GNUNET_TESTING_BarrierList); |
147 | } | 147 | } |
148 | 148 | ||
@@ -201,19 +201,21 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is, | |||
201 | { | 201 | { |
202 | const struct ConnectPeersState *cps; | 202 | const struct ConnectPeersState *cps; |
203 | const struct GNUNET_TESTING_Command *cmd; | 203 | const struct GNUNET_TESTING_Command *cmd; |
204 | void *ret = NULL; | ||
205 | 204 | ||
206 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 205 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
207 | "notify_connect peer %s\n", | 206 | "notify_connect peer %s\n", |
208 | GNUNET_i2s (peer)); | 207 | GNUNET_i2s (peer)); |
208 | // FIXME: modifying future is a bit unclean, not easy to follow logic; | ||
209 | // might be better to when reaching the future command to look into | ||
210 | // the past... | ||
209 | cmd = GNUNET_TESTING_interpreter_lookup_command_all (is, | 211 | cmd = GNUNET_TESTING_interpreter_lookup_command_all (is, |
210 | "connect-peers"); | 212 | "connect-peers"); |
213 | // FIXME: check return value! | ||
211 | GNUNET_TRANSPORT_get_trait_connect_peer_state (cmd, | 214 | GNUNET_TRANSPORT_get_trait_connect_peer_state (cmd, |
212 | &cps); | 215 | &cps); |
213 | cps->notify_connect (is, | 216 | cps->notify_connect (is, |
214 | peer); | 217 | peer); |
215 | 218 | return NULL; | |
216 | return ret; | ||
217 | } | 219 | } |
218 | 220 | ||
219 | 221 | ||
@@ -381,9 +383,9 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | |||
381 | ts->write_message = write_message; | 383 | ts->write_message = write_message; |
382 | 384 | ||
383 | is = GNUNET_TESTING_run (commands, | 385 | is = GNUNET_TESTING_run (commands, |
384 | TIMEOUT, | 386 | TIMEOUT, |
385 | &handle_result, | 387 | &handle_result, |
386 | ts); | 388 | ts); |
387 | return is; | 389 | return is; |
388 | } | 390 | } |
389 | 391 | ||
diff --git a/src/transport/test_transport_plugin_cmd_udp_backchannel.c b/src/transport/test_transport_plugin_cmd_udp_backchannel.c index 5e931fbe3..28cbd33ba 100644 --- a/src/transport/test_transport_plugin_cmd_udp_backchannel.c +++ b/src/transport/test_transport_plugin_cmd_udp_backchannel.c | |||
@@ -155,6 +155,7 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is, | |||
155 | return ret; | 155 | return ret; |
156 | } | 156 | } |
157 | 157 | ||
158 | |||
158 | /** | 159 | /** |
159 | * Callback to set the flag indicating all peers are prepared to finish. Will be called via the plugin api. | 160 | * Callback to set the flag indicating all peers are prepared to finish. Will be called via the plugin api. |
160 | */ | 161 | */ |
@@ -173,6 +174,7 @@ all_local_tests_prepared () | |||
173 | GNUNET_TESTING_AsyncContext *) &lfs->ac); | 174 | GNUNET_TESTING_AsyncContext *) &lfs->ac); |
174 | } | 175 | } |
175 | 176 | ||
177 | |||
176 | /** | 178 | /** |
177 | * Function to start a local test case. | 179 | * Function to start a local test case. |
178 | * | 180 | * |
diff --git a/src/transport/test_transport_start_with_config.c b/src/transport/test_transport_start_with_config.c index 8a7a3dbb5..9a8b5ee05 100644 --- a/src/transport/test_transport_start_with_config.c +++ b/src/transport/test_transport_start_with_config.c | |||
@@ -95,13 +95,13 @@ main (int argc, | |||
95 | topology_data_script, | 95 | topology_data_script, |
96 | &read_file), | 96 | &read_file), |
97 | GNUNET_TESTING_cmd_netjail_start_cmds_helper ("netjail-start-testbed", | 97 | GNUNET_TESTING_cmd_netjail_start_cmds_helper ("netjail-start-testbed", |
98 | topology, | 98 | topology, |
99 | &read_file, | 99 | &read_file, |
100 | topology_data_script, | 100 | topology_data_script, |
101 | TIMEOUT), | 101 | TIMEOUT), |
102 | GNUNET_TESTING_cmd_stop_cmds_helper ("stop-testbed", | 102 | GNUNET_TESTING_cmd_stop_cmds_helper ("stop-testbed", |
103 | "netjail-start-testbed", | 103 | "netjail-start-testbed", |
104 | topology), | 104 | topology), |
105 | GNUNET_TESTING_cmd_netjail_stop ("netjail-stop", | 105 | GNUNET_TESTING_cmd_netjail_stop ("netjail-stop", |
106 | topology_data_script, | 106 | topology_data_script, |
107 | &read_file), | 107 | &read_file), |
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c index 566e0db71..ec27ac8ba 100644 --- a/src/transport/transport-testing2.c +++ b/src/transport/transport-testing2.c | |||
@@ -329,6 +329,7 @@ notify_disconnect (void *cls, | |||
329 | } | 329 | } |
330 | } | 330 | } |
331 | 331 | ||
332 | |||
332 | static void | 333 | static void |
333 | retrieve_hello (void *cls); | 334 | retrieve_hello (void *cls); |
334 | 335 | ||
diff --git a/src/transport/transport_api_cmd_backchannel_check.c b/src/transport/transport_api_cmd_backchannel_check.c index d672e3ae8..1bdb8817f 100644 --- a/src/transport/transport_api_cmd_backchannel_check.c +++ b/src/transport/transport_api_cmd_backchannel_check.c | |||
@@ -330,6 +330,7 @@ will_the_other_node_connect_via_udp ( | |||
330 | return GNUNET_NO; | 330 | return GNUNET_NO; |
331 | } | 331 | } |
332 | 332 | ||
333 | |||
333 | static void | 334 | static void |
334 | add_search_string (struct CheckState *cs, const struct | 335 | add_search_string (struct CheckState *cs, const struct |
335 | GNUNET_TESTING_NetjailNode *node) | 336 | GNUNET_TESTING_NetjailNode *node) |
diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c index 7feecbcc7..6bc145880 100644 --- a/src/transport/transport_api_cmd_connecting_peers.c +++ b/src/transport/transport_api_cmd_connecting_peers.c | |||
@@ -126,10 +126,10 @@ connect_peers_run (void *cls, | |||
126 | char *rest2; | 126 | char *rest2; |
127 | char *address; | 127 | char *address; |
128 | 128 | ||
129 | prefix = strtok(addr, "_"); | 129 | prefix = strtok (addr, "_"); |
130 | rest = strtok(NULL, "_"); | 130 | rest = strtok (NULL, "_"); |
131 | rest2 = strtok(rest, "-"); | 131 | rest2 = strtok (rest, "-"); |
132 | address = strtok(NULL, "-"); | 132 | address = strtok (NULL, "-"); |
133 | 133 | ||
134 | GNUNET_asprintf (&addr_and_port, | 134 | GNUNET_asprintf (&addr_and_port, |
135 | "%s-%s:0", | 135 | "%s-%s:0", |
@@ -172,20 +172,23 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is, | |||
172 | const struct GNUNET_TESTING_Command *cmd; | 172 | const struct GNUNET_TESTING_Command *cmd; |
173 | struct ConnectPeersState *cps; | 173 | struct ConnectPeersState *cps; |
174 | struct GNUNET_PeerIdentity *peer_connection; | 174 | struct GNUNET_PeerIdentity *peer_connection; |
175 | struct GNUNET_TESTING_NodeConnection *pos_connection; | ||
176 | unsigned int num; | 175 | unsigned int num; |
177 | unsigned int con_num; | 176 | unsigned int con_num; |
178 | void *ret = NULL; | 177 | void *ret = NULL; |
179 | 178 | ||
180 | cmd = GNUNET_TESTING_interpreter_lookup_command_all (is, | 179 | cmd = GNUNET_TESTING_interpreter_lookup_command_all (is, |
181 | "connect-peers"); | 180 | "connect-peers"); |
182 | cps = cmd->cls; | 181 | cps = cmd->cls; // WTF? Never go directly into cls of another command! FIXME! |
183 | con_num = cps->con_num_notified; | 182 | con_num = cps->con_num_notified; |
184 | for (pos_connection = cps->node_connections_head; NULL != pos_connection; | 183 | for (struct GNUNET_TESTING_NodeConnection *pos_connection = |
184 | cps->node_connections_head; | ||
185 | NULL != pos_connection; | ||
185 | pos_connection = pos_connection->next) | 186 | pos_connection = pos_connection->next) |
186 | { | 187 | { |
187 | num = GNUNET_TESTING_calculate_num (pos_connection, cps->topology); | 188 | num = GNUNET_TESTING_calculate_num (pos_connection, |
188 | peer_connection = GNUNET_TESTING_get_peer (num, cps->tl_system); | 189 | cps->topology); |
190 | peer_connection = GNUNET_TESTING_get_peer (num, | ||
191 | cps->tl_system); | ||
189 | if (0 == GNUNET_memcmp (peer, | 192 | if (0 == GNUNET_memcmp (peer, |
190 | peer_connection)) | 193 | peer_connection)) |
191 | cps->con_num_notified++; | 194 | cps->con_num_notified++; |
diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c index 1f8ef2f8f..244f8d79b 100644 --- a/src/transport/transport_api_cmd_start_peer.c +++ b/src/transport/transport_api_cmd_start_peer.c | |||
@@ -385,7 +385,7 @@ start_peer_cleanup (void *cls) | |||
385 | GNUNET_free (sps->handlers); | 385 | GNUNET_free (sps->handlers); |
386 | sps->handlers = NULL; | 386 | sps->handlers = NULL; |
387 | } | 387 | } |
388 | //TODO Investigate why this caused problems during shutdown. | 388 | // TODO Investigate why this caused problems during shutdown. |
389 | /*if (NULL != sps->cfg) | 389 | /*if (NULL != sps->cfg) |
390 | { | 390 | { |
391 | GNUNET_CONFIGURATION_destroy (sps->cfg); | 391 | GNUNET_CONFIGURATION_destroy (sps->cfg); |