diff options
Diffstat (limited to 'src/revocation/test_revocation.c')
-rw-r--r-- | src/revocation/test_revocation.c | 424 |
1 files changed, 212 insertions, 212 deletions
diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c index 22df26165..22cb98887 100644 --- a/src/revocation/test_revocation.c +++ b/src/revocation/test_revocation.c | |||
@@ -16,7 +16,7 @@ | |||
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 revocation/test_revocation.c | 21 | * @file revocation/test_revocation.c |
22 | * @brief base testcase for revocation exchange | 22 | * @brief base testcase for revocation exchange |
@@ -31,8 +31,7 @@ | |||
31 | 31 | ||
32 | #define NUM_TEST_PEERS 2 | 32 | #define NUM_TEST_PEERS 2 |
33 | 33 | ||
34 | struct TestPeer | 34 | struct TestPeer { |
35 | { | ||
36 | struct GNUNET_TESTBED_Peer *p; | 35 | struct GNUNET_TESTBED_Peer *p; |
37 | struct GNUNET_TESTBED_Operation *identity_op; | 36 | struct GNUNET_TESTBED_Operation *identity_op; |
38 | struct GNUNET_TESTBED_Operation *core_op; | 37 | struct GNUNET_TESTBED_Operation *core_op; |
@@ -57,351 +56,352 @@ static int ok; | |||
57 | 56 | ||
58 | 57 | ||
59 | static void | 58 | static void |
60 | do_shutdown (void *cls) | 59 | do_shutdown(void *cls) |
61 | { | 60 | { |
62 | for (unsigned int c = 0; c < NUM_TEST_PEERS; c++) | 61 | for (unsigned int c = 0; c < NUM_TEST_PEERS; c++) |
63 | { | ||
64 | if (NULL != testpeers[c].create_id_op) | ||
65 | { | ||
66 | GNUNET_IDENTITY_cancel (testpeers[c].create_id_op); | ||
67 | testpeers[c].create_id_op = NULL; | ||
68 | } | ||
69 | if (NULL != testpeers[c].ego_lookup) | ||
70 | { | ||
71 | GNUNET_IDENTITY_ego_lookup_cancel (testpeers[c].ego_lookup); | ||
72 | testpeers[c].ego_lookup = NULL; | ||
73 | } | ||
74 | if (NULL != testpeers[c].revok_handle) | ||
75 | { | ||
76 | GNUNET_REVOCATION_revoke_cancel (testpeers[c].revok_handle); | ||
77 | testpeers[c].revok_handle = NULL; | ||
78 | } | ||
79 | if (NULL != testpeers[c].identity_op) | ||
80 | { | ||
81 | GNUNET_TESTBED_operation_done (testpeers[c].identity_op); | ||
82 | testpeers[c].identity_op = NULL; | ||
83 | } | ||
84 | if (NULL != testpeers[c].core_op) | ||
85 | { | 62 | { |
86 | GNUNET_TESTBED_operation_done (testpeers[c].core_op); | 63 | if (NULL != testpeers[c].create_id_op) |
87 | testpeers[c].core_op = NULL; | 64 | { |
65 | GNUNET_IDENTITY_cancel(testpeers[c].create_id_op); | ||
66 | testpeers[c].create_id_op = NULL; | ||
67 | } | ||
68 | if (NULL != testpeers[c].ego_lookup) | ||
69 | { | ||
70 | GNUNET_IDENTITY_ego_lookup_cancel(testpeers[c].ego_lookup); | ||
71 | testpeers[c].ego_lookup = NULL; | ||
72 | } | ||
73 | if (NULL != testpeers[c].revok_handle) | ||
74 | { | ||
75 | GNUNET_REVOCATION_revoke_cancel(testpeers[c].revok_handle); | ||
76 | testpeers[c].revok_handle = NULL; | ||
77 | } | ||
78 | if (NULL != testpeers[c].identity_op) | ||
79 | { | ||
80 | GNUNET_TESTBED_operation_done(testpeers[c].identity_op); | ||
81 | testpeers[c].identity_op = NULL; | ||
82 | } | ||
83 | if (NULL != testpeers[c].core_op) | ||
84 | { | ||
85 | GNUNET_TESTBED_operation_done(testpeers[c].core_op); | ||
86 | testpeers[c].core_op = NULL; | ||
87 | } | ||
88 | } | 88 | } |
89 | } | ||
90 | } | 89 | } |
91 | 90 | ||
92 | 91 | ||
93 | static void | 92 | static void |
94 | check_revocation (void *cls); | 93 | check_revocation(void *cls); |
95 | 94 | ||
96 | 95 | ||
97 | static void | 96 | static void |
98 | revocation_remote_cb (void *cls, int is_valid) | 97 | revocation_remote_cb(void *cls, int is_valid) |
99 | { | 98 | { |
100 | static int repeat = 0; | 99 | static int repeat = 0; |
101 | 100 | ||
102 | if (GNUNET_NO == is_valid) | 101 | if (GNUNET_NO == is_valid) |
103 | { | 102 | { |
104 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Local revocation successful\n"); | 103 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Local revocation successful\n"); |
105 | ok = 0; | 104 | ok = 0; |
106 | GNUNET_SCHEDULER_shutdown (); | 105 | GNUNET_SCHEDULER_shutdown(); |
107 | return; | 106 | return; |
108 | } | 107 | } |
109 | if (repeat < 10) | 108 | if (repeat < 10) |
110 | { | 109 | { |
111 | repeat++; | 110 | repeat++; |
112 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 111 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, |
113 | &check_revocation, | 112 | &check_revocation, |
114 | NULL); | 113 | NULL); |
115 | return; | 114 | return; |
116 | } | 115 | } |
117 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Flooding of revocation failed\n"); | 116 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Flooding of revocation failed\n"); |
118 | ok = 2; | 117 | ok = 2; |
119 | GNUNET_SCHEDULER_shutdown (); | 118 | GNUNET_SCHEDULER_shutdown(); |
120 | } | 119 | } |
121 | 120 | ||
122 | 121 | ||
123 | static void | 122 | static void |
124 | check_revocation (void *cls) | 123 | check_revocation(void *cls) |
125 | { | 124 | { |
126 | GNUNET_REVOCATION_query (testpeers[0].cfg, | 125 | GNUNET_REVOCATION_query(testpeers[0].cfg, |
127 | &testpeers[1].pubkey, | 126 | &testpeers[1].pubkey, |
128 | &revocation_remote_cb, | 127 | &revocation_remote_cb, |
129 | NULL); | 128 | NULL); |
130 | } | 129 | } |
131 | 130 | ||
132 | 131 | ||
133 | static void | 132 | static void |
134 | revocation_cb (void *cls, int is_valid) | 133 | revocation_cb(void *cls, int is_valid) |
135 | { | 134 | { |
136 | testpeers[1].revok_handle = NULL; | 135 | testpeers[1].revok_handle = NULL; |
137 | if (GNUNET_NO == is_valid) | 136 | if (GNUNET_NO == is_valid) |
138 | { | 137 | { |
139 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Revocation successful\n"); | 138 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Revocation successful\n"); |
140 | check_revocation (NULL); | 139 | check_revocation(NULL); |
141 | } | 140 | } |
142 | } | 141 | } |
143 | 142 | ||
144 | 143 | ||
145 | static void | 144 | static void |
146 | ego_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | 145 | ego_cb(void *cls, const struct GNUNET_IDENTITY_Ego *ego) |
147 | { | 146 | { |
148 | static int completed = 0; | 147 | static int completed = 0; |
149 | 148 | ||
150 | if ((NULL != ego) && (cls == &testpeers[0])) | 149 | if ((NULL != ego) && (cls == &testpeers[0])) |
151 | { | 150 | { |
152 | testpeers[0].ego_lookup = NULL; | 151 | testpeers[0].ego_lookup = NULL; |
153 | testpeers[0].privkey = GNUNET_IDENTITY_ego_get_private_key (ego); | 152 | testpeers[0].privkey = GNUNET_IDENTITY_ego_get_private_key(ego); |
154 | GNUNET_IDENTITY_ego_get_public_key (ego, &testpeers[0].pubkey); | 153 | GNUNET_IDENTITY_ego_get_public_key(ego, &testpeers[0].pubkey); |
155 | completed++; | 154 | completed++; |
156 | } | 155 | } |
157 | if ((NULL != ego) && (cls == &testpeers[1])) | 156 | if ((NULL != ego) && (cls == &testpeers[1])) |
158 | { | ||
159 | testpeers[1].ego_lookup = NULL; | ||
160 | testpeers[1].privkey = GNUNET_IDENTITY_ego_get_private_key (ego); | ||
161 | GNUNET_IDENTITY_ego_get_public_key (ego, &testpeers[1].pubkey); | ||
162 | GNUNET_REVOCATION_sign_revocation (testpeers[1].privkey, &testpeers[1].sig); | ||
163 | |||
164 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Calculating proof of work...\n"); | ||
165 | testpeers[1].pow = 0; | ||
166 | int res = | ||
167 | GNUNET_REVOCATION_check_pow (&testpeers[1].pubkey, testpeers[1].pow, 5); | ||
168 | while (GNUNET_OK != res) | ||
169 | { | 157 | { |
170 | testpeers[1].pow++; | 158 | testpeers[1].ego_lookup = NULL; |
171 | res = | 159 | testpeers[1].privkey = GNUNET_IDENTITY_ego_get_private_key(ego); |
172 | GNUNET_REVOCATION_check_pow (&testpeers[1].pubkey, testpeers[1].pow, 5); | 160 | GNUNET_IDENTITY_ego_get_public_key(ego, &testpeers[1].pubkey); |
161 | GNUNET_REVOCATION_sign_revocation(testpeers[1].privkey, &testpeers[1].sig); | ||
162 | |||
163 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Calculating proof of work...\n"); | ||
164 | testpeers[1].pow = 0; | ||
165 | int res = | ||
166 | GNUNET_REVOCATION_check_pow(&testpeers[1].pubkey, testpeers[1].pow, 5); | ||
167 | while (GNUNET_OK != res) | ||
168 | { | ||
169 | testpeers[1].pow++; | ||
170 | res = | ||
171 | GNUNET_REVOCATION_check_pow(&testpeers[1].pubkey, testpeers[1].pow, 5); | ||
172 | } | ||
173 | fprintf(stderr, "Done calculating proof of work\n"); | ||
174 | completed++; | ||
173 | } | 175 | } |
174 | fprintf (stderr, "Done calculating proof of work\n"); | ||
175 | completed++; | ||
176 | } | ||
177 | if (2 == completed) | 176 | if (2 == completed) |
178 | { | 177 | { |
179 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Egos retrieved\n"); | 178 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Egos retrieved\n"); |
180 | testpeers[1].revok_handle = GNUNET_REVOCATION_revoke (testpeers[1].cfg, | 179 | testpeers[1].revok_handle = GNUNET_REVOCATION_revoke(testpeers[1].cfg, |
181 | &testpeers[1].pubkey, | 180 | &testpeers[1].pubkey, |
182 | &testpeers[1].sig, | 181 | &testpeers[1].sig, |
183 | testpeers[1].pow, | 182 | testpeers[1].pow, |
184 | &revocation_cb, | 183 | &revocation_cb, |
185 | NULL); | 184 | NULL); |
186 | } | 185 | } |
187 | } | 186 | } |
188 | 187 | ||
189 | 188 | ||
190 | static void | 189 | static void |
191 | identity_create_cb (void *cls, | 190 | identity_create_cb(void *cls, |
192 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, | 191 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, |
193 | const char *emsg) | 192 | const char *emsg) |
194 | { | 193 | { |
195 | static int completed = 0; | 194 | static int completed = 0; |
196 | 195 | ||
197 | if ((NULL == emsg) && (cls == &testpeers[0])) | 196 | if ((NULL == emsg) && (cls == &testpeers[0])) |
198 | { | 197 | { |
199 | testpeers[0].create_id_op = NULL; | 198 | testpeers[0].create_id_op = NULL; |
200 | completed++; | 199 | completed++; |
201 | } | 200 | } |
202 | if ((NULL == emsg) && (cls == &testpeers[1])) | 201 | if ((NULL == emsg) && (cls == &testpeers[1])) |
203 | { | 202 | { |
204 | testpeers[1].create_id_op = NULL; | 203 | testpeers[1].create_id_op = NULL; |
205 | completed++; | 204 | completed++; |
206 | } | 205 | } |
207 | if (2 != completed) | 206 | if (2 != completed) |
208 | return; | 207 | return; |
209 | fprintf (stderr, "Identities created\n"); | 208 | fprintf(stderr, "Identities created\n"); |
210 | testpeers[0].ego_lookup = GNUNET_IDENTITY_ego_lookup (testpeers[0].cfg, | 209 | testpeers[0].ego_lookup = GNUNET_IDENTITY_ego_lookup(testpeers[0].cfg, |
211 | "client", | 210 | "client", |
212 | &ego_cb, | 211 | &ego_cb, |
213 | &testpeers[0]); | 212 | &testpeers[0]); |
214 | testpeers[1].ego_lookup = GNUNET_IDENTITY_ego_lookup (testpeers[1].cfg, | 213 | testpeers[1].ego_lookup = GNUNET_IDENTITY_ego_lookup(testpeers[1].cfg, |
215 | "toberevoked", | 214 | "toberevoked", |
216 | &ego_cb, | 215 | &ego_cb, |
217 | &testpeers[1]); | 216 | &testpeers[1]); |
218 | } | 217 | } |
219 | 218 | ||
220 | 219 | ||
221 | static void | 220 | static void |
222 | identity_completion_cb (void *cls, | 221 | identity_completion_cb(void *cls, |
223 | struct GNUNET_TESTBED_Operation *op, | 222 | struct GNUNET_TESTBED_Operation *op, |
224 | void *ca_result, | 223 | void *ca_result, |
225 | const char *emsg) | 224 | const char *emsg) |
226 | { | 225 | { |
227 | static int completed = 0; | 226 | static int completed = 0; |
228 | 227 | ||
229 | completed++; | 228 | completed++; |
230 | if (NUM_TEST_PEERS != completed) | 229 | if (NUM_TEST_PEERS != completed) |
231 | return; | 230 | return; |
232 | fprintf (stderr, "All peers connected @ IDENTITY ...\n"); | 231 | fprintf(stderr, "All peers connected @ IDENTITY ...\n"); |
233 | testpeers[0].create_id_op = GNUNET_IDENTITY_create (testpeers[0].idh, | 232 | testpeers[0].create_id_op = GNUNET_IDENTITY_create(testpeers[0].idh, |
234 | "client", | 233 | "client", |
235 | &identity_create_cb, | 234 | &identity_create_cb, |
236 | &testpeers[0]); | 235 | &testpeers[0]); |
237 | testpeers[1].create_id_op = GNUNET_IDENTITY_create (testpeers[1].idh, | 236 | testpeers[1].create_id_op = GNUNET_IDENTITY_create(testpeers[1].idh, |
238 | "toberevoked", | 237 | "toberevoked", |
239 | &identity_create_cb, | 238 | &identity_create_cb, |
240 | &testpeers[1]); | 239 | &testpeers[1]); |
241 | } | 240 | } |
242 | 241 | ||
243 | 242 | ||
244 | static void * | 243 | static void * |
245 | identity_connect_adapter (void *cls, | 244 | identity_connect_adapter(void *cls, |
246 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 245 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
247 | { | 246 | { |
248 | struct TestPeer *me = cls; | 247 | struct TestPeer *me = cls; |
249 | 248 | ||
250 | me->cfg = cfg; | 249 | me->cfg = cfg; |
251 | me->idh = GNUNET_IDENTITY_connect (cfg, NULL, NULL); | 250 | me->idh = GNUNET_IDENTITY_connect(cfg, NULL, NULL); |
252 | if (NULL == me->idh) | 251 | if (NULL == me->idh) |
253 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create IDENTITY handle \n"); | 252 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to create IDENTITY handle \n"); |
254 | return me->idh; | 253 | return me->idh; |
255 | } | 254 | } |
256 | 255 | ||
257 | 256 | ||
258 | static void | 257 | static void |
259 | identity_disconnect_adapter (void *cls, void *op_result) | 258 | identity_disconnect_adapter(void *cls, void *op_result) |
260 | { | 259 | { |
261 | struct TestPeer *me = cls; | 260 | struct TestPeer *me = cls; |
262 | GNUNET_IDENTITY_disconnect (me->idh); | 261 | |
262 | GNUNET_IDENTITY_disconnect(me->idh); | ||
263 | me->idh = NULL; | 263 | me->idh = NULL; |
264 | } | 264 | } |
265 | 265 | ||
266 | 266 | ||
267 | static void * | 267 | static void * |
268 | connect_cb (void *cls, | 268 | connect_cb(void *cls, |
269 | const struct GNUNET_PeerIdentity *peer, | 269 | const struct GNUNET_PeerIdentity *peer, |
270 | struct GNUNET_MQ_Handle *mq) | 270 | struct GNUNET_MQ_Handle *mq) |
271 | { | 271 | { |
272 | static int connects = 0; | 272 | static int connects = 0; |
273 | 273 | ||
274 | connects++; | 274 | connects++; |
275 | if (NUM_TEST_PEERS * NUM_TEST_PEERS == connects) | 275 | if (NUM_TEST_PEERS * NUM_TEST_PEERS == connects) |
276 | { | 276 | { |
277 | fprintf (stderr, "All peers connected @ CORE ...\n"); | 277 | fprintf(stderr, "All peers connected @ CORE ...\n"); |
278 | 278 | ||
279 | /* Connect to identity service */ | 279 | /* Connect to identity service */ |
280 | testpeers[0].identity_op = | 280 | testpeers[0].identity_op = |
281 | GNUNET_TESTBED_service_connect (NULL, | 281 | GNUNET_TESTBED_service_connect(NULL, |
282 | testpeers[0].p, | 282 | testpeers[0].p, |
283 | "identity", | 283 | "identity", |
284 | &identity_completion_cb, | 284 | &identity_completion_cb, |
285 | NULL, | 285 | NULL, |
286 | &identity_connect_adapter, | 286 | &identity_connect_adapter, |
287 | &identity_disconnect_adapter, | 287 | &identity_disconnect_adapter, |
288 | &testpeers[0]); | 288 | &testpeers[0]); |
289 | testpeers[1].identity_op = | 289 | testpeers[1].identity_op = |
290 | GNUNET_TESTBED_service_connect (NULL, | 290 | GNUNET_TESTBED_service_connect(NULL, |
291 | testpeers[1].p, | 291 | testpeers[1].p, |
292 | "identity", | 292 | "identity", |
293 | *identity_completion_cb, | 293 | *identity_completion_cb, |
294 | NULL, | 294 | NULL, |
295 | &identity_connect_adapter, | 295 | &identity_connect_adapter, |
296 | &identity_disconnect_adapter, | 296 | &identity_disconnect_adapter, |
297 | &testpeers[1]); | 297 | &testpeers[1]); |
298 | } | 298 | } |
299 | return NULL; | 299 | return NULL; |
300 | } | 300 | } |
301 | 301 | ||
302 | 302 | ||
303 | static void | 303 | static void |
304 | core_completion_cb (void *cls, | 304 | core_completion_cb(void *cls, |
305 | struct GNUNET_TESTBED_Operation *op, | 305 | struct GNUNET_TESTBED_Operation *op, |
306 | void *ca_result, | 306 | void *ca_result, |
307 | const char *emsg) | 307 | const char *emsg) |
308 | { | 308 | { |
309 | static int completed = 0; | 309 | static int completed = 0; |
310 | 310 | ||
311 | completed++; | 311 | completed++; |
312 | if (NUM_TEST_PEERS == completed) | 312 | if (NUM_TEST_PEERS == completed) |
313 | { | 313 | { |
314 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connected to CORE\n"); | 314 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Connected to CORE\n"); |
315 | } | 315 | } |
316 | } | 316 | } |
317 | 317 | ||
318 | 318 | ||
319 | static void * | 319 | static void * |
320 | core_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) | 320 | core_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) |
321 | { | 321 | { |
322 | struct TestPeer *me = cls; | 322 | struct TestPeer *me = cls; |
323 | 323 | ||
324 | me->cfg = cfg; | 324 | me->cfg = cfg; |
325 | me->ch = GNUNET_CORE_connect (cfg, me, NULL, &connect_cb, NULL, NULL); | 325 | me->ch = GNUNET_CORE_connect(cfg, me, NULL, &connect_cb, NULL, NULL); |
326 | if (NULL == me->ch) | 326 | if (NULL == me->ch) |
327 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create CORE handle \n"); | 327 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to create CORE handle \n"); |
328 | return me->ch; | 328 | return me->ch; |
329 | } | 329 | } |
330 | 330 | ||
331 | 331 | ||
332 | static void | 332 | static void |
333 | core_disconnect_adapter (void *cls, void *op_result) | 333 | core_disconnect_adapter(void *cls, void *op_result) |
334 | { | 334 | { |
335 | struct TestPeer *me = cls; | 335 | struct TestPeer *me = cls; |
336 | 336 | ||
337 | GNUNET_CORE_disconnect (me->ch); | 337 | GNUNET_CORE_disconnect(me->ch); |
338 | me->ch = NULL; | 338 | me->ch = NULL; |
339 | } | 339 | } |
340 | 340 | ||
341 | 341 | ||
342 | static void | 342 | static void |
343 | test_connection (void *cls, | 343 | test_connection(void *cls, |
344 | struct GNUNET_TESTBED_RunHandle *h, | 344 | struct GNUNET_TESTBED_RunHandle *h, |
345 | unsigned int num_peers, | 345 | unsigned int num_peers, |
346 | struct GNUNET_TESTBED_Peer **peers, | 346 | struct GNUNET_TESTBED_Peer **peers, |
347 | unsigned int links_succeeded, | 347 | unsigned int links_succeeded, |
348 | unsigned int links_failed) | 348 | unsigned int links_failed) |
349 | { | 349 | { |
350 | unsigned int c; | 350 | unsigned int c; |
351 | 351 | ||
352 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); | 352 | GNUNET_SCHEDULER_add_shutdown(&do_shutdown, NULL); |
353 | if (NUM_TEST_PEERS != num_peers) | 353 | if (NUM_TEST_PEERS != num_peers) |
354 | { | 354 | { |
355 | ok = 4; | 355 | ok = 4; |
356 | fprintf (stderr, | 356 | fprintf(stderr, |
357 | "Only %u out of %u peers were started ...\n", | 357 | "Only %u out of %u peers were started ...\n", |
358 | num_peers, | 358 | num_peers, |
359 | NUM_TEST_PEERS); | 359 | NUM_TEST_PEERS); |
360 | GNUNET_SCHEDULER_shutdown (); | 360 | GNUNET_SCHEDULER_shutdown(); |
361 | return; | 361 | return; |
362 | } | 362 | } |
363 | /* We are generating a CLIQUE */ | 363 | /* We are generating a CLIQUE */ |
364 | if (NUM_TEST_PEERS * (NUM_TEST_PEERS - 1) == links_succeeded) | 364 | if (NUM_TEST_PEERS * (NUM_TEST_PEERS - 1) == links_succeeded) |
365 | { | ||
366 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
367 | "Testbed connected peers, initializing test\n"); | ||
368 | for (c = 0; c < num_peers; c++) | ||
369 | { | 365 | { |
370 | testpeers[c].p = peers[c]; | 366 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
371 | testpeers[c].core_op = | 367 | "Testbed connected peers, initializing test\n"); |
372 | GNUNET_TESTBED_service_connect (NULL, | 368 | for (c = 0; c < num_peers; c++) |
373 | testpeers[c].p, | 369 | { |
374 | "core", | 370 | testpeers[c].p = peers[c]; |
375 | &core_completion_cb, | 371 | testpeers[c].core_op = |
376 | NULL, | 372 | GNUNET_TESTBED_service_connect(NULL, |
377 | &core_connect_adapter, | 373 | testpeers[c].p, |
378 | &core_disconnect_adapter, | 374 | "core", |
379 | &testpeers[c]); | 375 | &core_completion_cb, |
376 | NULL, | ||
377 | &core_connect_adapter, | ||
378 | &core_disconnect_adapter, | ||
379 | &testpeers[c]); | ||
380 | } | ||
380 | } | 381 | } |
381 | } | ||
382 | else | 382 | else |
383 | { | 383 | { |
384 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Testbed failed to connect peers\n"); | 384 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Testbed failed to connect peers\n"); |
385 | ok = 5; | 385 | ok = 5; |
386 | GNUNET_SCHEDULER_shutdown (); | 386 | GNUNET_SCHEDULER_shutdown(); |
387 | return; | 387 | return; |
388 | } | 388 | } |
389 | } | 389 | } |
390 | 390 | ||
391 | 391 | ||
392 | int | 392 | int |
393 | main (int argc, char *argv[]) | 393 | main(int argc, char *argv[]) |
394 | { | 394 | { |
395 | ok = 1; | 395 | ok = 1; |
396 | /* Connecting initial topology */ | 396 | /* Connecting initial topology */ |
397 | (void) GNUNET_TESTBED_test_run ("test-revocation", | 397 | (void)GNUNET_TESTBED_test_run("test-revocation", |
398 | "test_revocation.conf", | 398 | "test_revocation.conf", |
399 | NUM_TEST_PEERS, | 399 | NUM_TEST_PEERS, |
400 | 0, | 400 | 0, |
401 | NULL, | 401 | NULL, |
402 | NULL, | 402 | NULL, |
403 | &test_connection, | 403 | &test_connection, |
404 | NULL); | 404 | NULL); |
405 | return ok; | 405 | return ok; |
406 | } | 406 | } |
407 | 407 | ||