aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_block_until_external_trigger.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_block_until_external_trigger.c')
-rw-r--r--src/testing/testing_api_cmd_block_until_external_trigger.c57
1 files changed, 10 insertions, 47 deletions
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 d69040b75..b416fa595 100644
--- a/src/testing/testing_api_cmd_block_until_external_trigger.c
+++ b/src/testing/testing_api_cmd_block_until_external_trigger.c
@@ -40,27 +40,12 @@ struct BlockState
40{ 40{
41 /** 41 /**
42 * Flag to indicate if all peers have started. 42 * Flag to indicate if all peers have started.
43 *
44 */ 43 */
45 unsigned int *stop_blocking; 44 unsigned int *stop_blocking;
46}; 45};
47 46
48 47
49/** 48/**
50 * Trait function of this cmd does nothing.
51 *
52 */
53static int
54block_until_all_peers_started_traits (void *cls,
55 const void **ret,
56 const char *trait,
57 unsigned int index)
58{
59 return GNUNET_NO;
60}
61
62
63/**
64 * The cleanup function of this cmd frees resources the cmd allocated. 49 * The cleanup function of this cmd frees resources the cmd allocated.
65 * 50 *
66 */ 51 */
@@ -87,27 +72,6 @@ block_until_all_peers_started_run (void *cls,
87 72
88 73
89/** 74/**
90 * Function to check if BlockState#all_peers_started is GNUNET_YES. In that case interpreter_next will be called.
91 *
92 */
93static int
94block_until_all_peers_started_finish (void *cls,
95 GNUNET_SCHEDULER_TaskCallback cont,
96 void *cont_cls)
97{
98 struct BlockState *bs = cls;
99 unsigned int *ret = bs->stop_blocking;
100
101 if (GNUNET_YES == *ret)
102 {
103 cont (cont_cls);
104 }
105
106 return *ret;
107}
108
109
110/**
111 * Create command. 75 * Create command.
112 * 76 *
113 * @param label name for command. 77 * @param label name for command.
@@ -123,15 +87,14 @@ GNUNET_TESTING_cmd_block_until_external_trigger (const char *label,
123 87
124 bs = GNUNET_new (struct BlockState); 88 bs = GNUNET_new (struct BlockState);
125 bs->stop_blocking = stop_blocking; 89 bs->stop_blocking = stop_blocking;
126 90 {
127 struct GNUNET_TESTING_Command cmd = { 91 struct GNUNET_TESTING_Command cmd = {
128 .cls = bs, 92 .cls = bs,
129 .label = label, 93 .label = label,
130 .run = &block_until_all_peers_started_run, 94 .run = &block_until_all_peers_started_run,
131 .finish = &block_until_all_peers_started_finish, 95 .cleanup = &block_until_all_peers_started_cleanup,
132 .cleanup = &block_until_all_peers_started_cleanup, 96 };
133 .traits = &block_until_all_peers_started_traits 97
134 }; 98 return cmd;
135 99 }
136 return cmd;
137} 100}