diff options
Diffstat (limited to 'src/transport/transport_api_cmd_backchannel_check.c')
-rw-r--r-- | src/transport/transport_api_cmd_backchannel_check.c | 51 |
1 files changed, 15 insertions, 36 deletions
diff --git a/src/transport/transport_api_cmd_backchannel_check.c b/src/transport/transport_api_cmd_backchannel_check.c index 5cc13dbfa..03b231347 100644 --- a/src/transport/transport_api_cmd_backchannel_check.c +++ b/src/transport/transport_api_cmd_backchannel_check.c | |||
@@ -51,6 +51,11 @@ | |||
51 | struct CheckState | 51 | struct CheckState |
52 | { | 52 | { |
53 | /** | 53 | /** |
54 | * Context for our asynchronous completion. | ||
55 | */ | ||
56 | struct GNUNET_TESTING_AsyncContext ac; | ||
57 | |||
58 | /** | ||
54 | * The number of the node in a network namespace. | 59 | * The number of the node in a network namespace. |
55 | */ | 60 | */ |
56 | unsigned int node_n; | 61 | unsigned int node_n; |
@@ -119,11 +124,6 @@ struct CheckState | |||
119 | * Stream to read log file lines. | 124 | * Stream to read log file lines. |
120 | */ | 125 | */ |
121 | FILE *stream; | 126 | FILE *stream; |
122 | |||
123 | /** | ||
124 | * Did we get all bachchannel messages. | ||
125 | */ | ||
126 | enum GNUNET_GenericReturnValue finished; | ||
127 | }; | 127 | }; |
128 | 128 | ||
129 | /** | 129 | /** |
@@ -195,7 +195,7 @@ read_from_log (void *cls) | |||
195 | strcmp ( | 195 | strcmp ( |
196 | "Delivering backchannel message from 4TTC to F7B5 of type 1460 to udp", | 196 | "Delivering backchannel message from 4TTC to F7B5 of type 1460 to udp", |
197 | cs->search_string[i])); | 197 | cs->search_string[i])); |
198 | cs->finished = GNUNET_YES; | 198 | GNUNET_TESTING_async_finish (&cs->ac); |
199 | fclose (cs->stream); | 199 | fclose (cs->stream); |
200 | return; | 200 | return; |
201 | } | 201 | } |
@@ -396,7 +396,6 @@ add_search_string (struct CheckState *cs, const struct | |||
396 | */ | 396 | */ |
397 | static void | 397 | static void |
398 | backchannel_check_run (void *cls, | 398 | backchannel_check_run (void *cls, |
399 | const struct GNUNET_TESTING_Command *cmd, | ||
400 | struct GNUNET_TESTING_Interpreter *is) | 399 | struct GNUNET_TESTING_Interpreter *is) |
401 | { | 400 | { |
402 | struct CheckState *cs = cls; | 401 | struct CheckState *cs = cls; |
@@ -418,12 +417,13 @@ backchannel_check_run (void *cls, | |||
418 | const struct GNUNET_TESTING_NetjailNode *node; | 417 | const struct GNUNET_TESTING_NetjailNode *node; |
419 | const struct GNUNET_TESTING_NetjailNamespace *namespace; | 418 | const struct GNUNET_TESTING_NetjailNamespace *namespace; |
420 | 419 | ||
421 | peer1_cmd = GNUNET_TESTING_interpreter_lookup_command ( | 420 | peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is, |
422 | cs->start_peer_label); | 421 | cs->start_peer_label); |
423 | GNUNET_TRANSPORT_get_trait_application_handle_v2 (peer1_cmd, | 422 | GNUNET_TRANSPORT_get_trait_application_handle (peer1_cmd, |
424 | &ah); | 423 | &ah); |
425 | 424 | ||
426 | system_cmd = GNUNET_TESTING_interpreter_lookup_command (cs->create_label); | 425 | system_cmd = GNUNET_TESTING_interpreter_lookup_command (is, |
426 | cs->create_label); | ||
427 | GNUNET_TESTING_get_trait_test_system (system_cmd, | 427 | GNUNET_TESTING_get_trait_test_system (system_cmd, |
428 | &tl_system); | 428 | &tl_system); |
429 | 429 | ||
@@ -524,28 +524,8 @@ backchannel_check_run (void *cls, | |||
524 | cs); | 524 | cs); |
525 | } | 525 | } |
526 | else | 526 | else |
527 | cs->finished = GNUNET_YES; | 527 | GNUNET_TESTING_async_finish (&cs->ac); |
528 | |||
529 | } | ||
530 | |||
531 | 528 | ||
532 | /** | ||
533 | * The finish function of this cmd will check if the peers we are trying to | ||
534 | * connect to are in the connected peers map of the start peer cmd for this peer. | ||
535 | * | ||
536 | */ | ||
537 | static int | ||
538 | backchannel_check_finish (void *cls, | ||
539 | GNUNET_SCHEDULER_TaskCallback cont, | ||
540 | void *cont_cls) | ||
541 | { | ||
542 | struct CheckState *cs = cls; | ||
543 | |||
544 | if (cs->finished) | ||
545 | { | ||
546 | cont (cont_cls); | ||
547 | } | ||
548 | return cs->finished; | ||
549 | } | 529 | } |
550 | 530 | ||
551 | 531 | ||
@@ -568,8 +548,7 @@ backchannel_check_traits (void *cls, | |||
568 | * | 548 | * |
569 | */ | 549 | */ |
570 | static void | 550 | static void |
571 | backchannel_check_cleanup (void *cls, | 551 | backchannel_check_cleanup (void *cls) |
572 | const struct GNUNET_TESTING_Command *cmd) | ||
573 | { | 552 | { |
574 | struct ConnectPeersState *cs = cls; | 553 | struct ConnectPeersState *cs = cls; |
575 | 554 | ||
@@ -613,7 +592,7 @@ GNUNET_TRANSPORT_cmd_backchannel_check (const char *label, | |||
613 | .cls = cs, | 592 | .cls = cs, |
614 | .label = label, | 593 | .label = label, |
615 | .run = &backchannel_check_run, | 594 | .run = &backchannel_check_run, |
616 | .finish = &backchannel_check_finish, | 595 | .ac = &cs->ac, |
617 | .cleanup = &backchannel_check_cleanup, | 596 | .cleanup = &backchannel_check_cleanup, |
618 | .traits = &backchannel_check_traits | 597 | .traits = &backchannel_check_traits |
619 | }; | 598 | }; |