diff options
Diffstat (limited to 'src/messenger/test_messenger_anonymous.c')
-rw-r--r-- | src/messenger/test_messenger_anonymous.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/messenger/test_messenger_anonymous.c b/src/messenger/test_messenger_anonymous.c index 8431d186f..1bb8e14da 100644 --- a/src/messenger/test_messenger_anonymous.c +++ b/src/messenger/test_messenger_anonymous.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020--2021 GNUnet e.V. | 3 | Copyright (C) 2020--2023 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -73,6 +73,7 @@ end (void *cls) | |||
73 | status = 0; | 73 | status = 0; |
74 | } | 74 | } |
75 | 75 | ||
76 | |||
76 | static void | 77 | static void |
77 | end_badly (void *cls) | 78 | end_badly (void *cls) |
78 | { | 79 | { |
@@ -82,12 +83,15 @@ end_badly (void *cls) | |||
82 | status = 1; | 83 | status = 1; |
83 | } | 84 | } |
84 | 85 | ||
86 | |||
85 | static void | 87 | static void |
86 | end_operation (void *cls) | 88 | end_operation (void *cls) |
87 | { | 89 | { |
88 | op_task = NULL; | 90 | op_task = NULL; |
89 | 91 | ||
90 | fprintf (stderr, "Testcase failed (operation: '%s').\n", cls ? (const char*) cls : "unknown"); | 92 | fprintf (stderr, "Testcase failed (operation: '%s').\n", cls ? (const |
93 | char*) cls : | ||
94 | "unknown"); | ||
91 | 95 | ||
92 | if (die_task) | 96 | if (die_task) |
93 | GNUNET_SCHEDULER_cancel (die_task); | 97 | GNUNET_SCHEDULER_cancel (die_task); |
@@ -96,6 +100,7 @@ end_operation (void *cls) | |||
96 | status = 1; | 100 | status = 1; |
97 | } | 101 | } |
98 | 102 | ||
103 | |||
99 | /** | 104 | /** |
100 | * Function called when an identity is retrieved. | 105 | * Function called when an identity is retrieved. |
101 | * | 106 | * |
@@ -123,7 +128,8 @@ on_iteration (void *cls) | |||
123 | return; | 128 | return; |
124 | } | 129 | } |
125 | 130 | ||
126 | const struct GNUNET_IDENTITY_PublicKey *key = GNUNET_MESSENGER_get_key (handle); | 131 | const struct GNUNET_IDENTITY_PublicKey *key = GNUNET_MESSENGER_get_key ( |
132 | handle); | ||
127 | 133 | ||
128 | if (key) | 134 | if (key) |
129 | { | 135 | { |
@@ -141,6 +147,7 @@ on_iteration (void *cls) | |||
141 | die_task = GNUNET_SCHEDULER_add_now (&end, NULL); | 147 | die_task = GNUNET_SCHEDULER_add_now (&end, NULL); |
142 | } | 148 | } |
143 | 149 | ||
150 | |||
144 | /** | 151 | /** |
145 | * Main function for testcase. | 152 | * Main function for testcase. |
146 | * | 153 | * |
@@ -155,13 +162,15 @@ run (void *cls, | |||
155 | { | 162 | { |
156 | die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL); | 163 | die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL); |
157 | 164 | ||
158 | op_task = GNUNET_SCHEDULER_add_delayed (BASE_TIMEOUT, &end_operation, "connect"); | 165 | op_task = GNUNET_SCHEDULER_add_delayed (BASE_TIMEOUT, &end_operation, |
166 | "connect"); | ||
159 | messenger = GNUNET_MESSENGER_connect (cfg, NULL, NULL, NULL, NULL); | 167 | messenger = GNUNET_MESSENGER_connect (cfg, NULL, NULL, NULL, NULL); |
160 | 168 | ||
161 | if (messenger) | 169 | if (messenger) |
162 | it_task = GNUNET_SCHEDULER_add_now (&on_iteration, messenger); | 170 | it_task = GNUNET_SCHEDULER_add_now (&on_iteration, messenger); |
163 | } | 171 | } |
164 | 172 | ||
173 | |||
165 | /** | 174 | /** |
166 | * The main function. | 175 | * The main function. |
167 | * | 176 | * |
@@ -173,7 +182,8 @@ int | |||
173 | main (int argc, | 182 | main (int argc, |
174 | char **argv) | 183 | char **argv) |
175 | { | 184 | { |
176 | if (0 != GNUNET_TESTING_peer_run ("test-messenger", "test_messenger_api.conf", &run, NULL)) | 185 | if (0 != GNUNET_TESTING_peer_run ("test-messenger", "test_messenger_api.conf", |
186 | &run, NULL)) | ||
177 | return 1; | 187 | return 1; |
178 | 188 | ||
179 | return status; | 189 | return status; |