aboutsummaryrefslogtreecommitdiff
path: root/src/dht/test_dht_twopeer_path_tracking.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/test_dht_twopeer_path_tracking.c')
-rw-r--r--src/dht/test_dht_twopeer_path_tracking.c348
1 files changed, 178 insertions, 170 deletions
diff --git a/src/dht/test_dht_twopeer_path_tracking.c b/src/dht/test_dht_twopeer_path_tracking.c
index d4e5a1332..ab0b1edd2 100644
--- a/src/dht/test_dht_twopeer_path_tracking.c
+++ b/src/dht/test_dht_twopeer_path_tracking.c
@@ -115,14 +115,14 @@ static struct GNUNET_DHT_Handle *peer2dht;
115/** 115/**
116 * Check whether peers successfully shut down. 116 * Check whether peers successfully shut down.
117 */ 117 */
118void shutdown_callback (void *cls, 118void
119 const char *emsg) 119shutdown_callback (void *cls, const char *emsg)
120{ 120{
121 if (emsg != NULL) 121 if (emsg != NULL)
122 { 122 {
123 if (ok == 0) 123 if (ok == 0)
124 ok = 2; 124 ok = 2;
125 } 125 }
126} 126}
127 127
128/** 128/**
@@ -130,13 +130,13 @@ void shutdown_callback (void *cls,
130 * testcase. Specifically, called when our get request completes. 130 * testcase. Specifically, called when our get request completes.
131 */ 131 */
132static void 132static void
133finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) 133finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
134{ 134{
135 GNUNET_assert (pg != NULL); 135 GNUNET_assert (pg != NULL);
136 GNUNET_assert (peer1dht != NULL); 136 GNUNET_assert (peer1dht != NULL);
137 GNUNET_assert (peer2dht != NULL); 137 GNUNET_assert (peer2dht != NULL);
138 GNUNET_DHT_disconnect(peer1dht); 138 GNUNET_DHT_disconnect (peer1dht);
139 GNUNET_DHT_disconnect(peer2dht); 139 GNUNET_DHT_disconnect (peer2dht);
140 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); 140 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
141 ok = 0; 141 ok = 0;
142} 142}
@@ -146,13 +146,13 @@ finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
146 * down the peers without freeing memory associated with GET request. 146 * down the peers without freeing memory associated with GET request.
147 */ 147 */
148static void 148static void
149end_badly_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) 149end_badly_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
150{ 150{
151 if (peer1dht != NULL) 151 if (peer1dht != NULL)
152 GNUNET_DHT_disconnect(peer1dht); 152 GNUNET_DHT_disconnect (peer1dht);
153 153
154 if (peer2dht != NULL) 154 if (peer2dht != NULL)
155 GNUNET_DHT_disconnect(peer2dht); 155 GNUNET_DHT_disconnect (peer2dht);
156 156
157 if (pg != NULL) 157 if (pg != NULL)
158 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); 158 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
@@ -164,15 +164,16 @@ end_badly_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
164 * test. 164 * test.
165 */ 165 */
166static void 166static void
167end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) 167end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
168{ 168{
169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failing test with error: `%s'!\n", (char *)cls); 169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failing test with error: `%s'!\n",
170 (char *) cls);
170 if (global_get_handle != NULL) 171 if (global_get_handle != NULL)
171 { 172 {
172 GNUNET_DHT_get_stop(global_get_handle); 173 GNUNET_DHT_get_stop (global_get_handle);
173 global_get_handle = NULL; 174 global_get_handle = NULL;
174 } 175 }
175 GNUNET_SCHEDULER_add_now(&end_badly_cont, NULL); 176 GNUNET_SCHEDULER_add_now (&end_badly_cont, NULL);
176 ok = 1; 177 ok = 1;
177} 178}
178 179
@@ -186,51 +187,54 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
186 * @param size number of bytes in data 187 * @param size number of bytes in data
187 * @param data pointer to the result data 188 * @param data pointer to the result data
188 */ 189 */
189void get_result_iterator (void *cls, 190void
190 struct GNUNET_TIME_Absolute exp, 191get_result_iterator (void *cls,
191 const GNUNET_HashCode * key, 192 struct GNUNET_TIME_Absolute exp,
192 const struct GNUNET_PeerIdentity * const *get_path, 193 const GNUNET_HashCode * key,
193 const struct GNUNET_PeerIdentity * const *put_path, 194 const struct GNUNET_PeerIdentity *const *get_path,
194 enum GNUNET_BLOCK_Type type, 195 const struct GNUNET_PeerIdentity *const *put_path,
195 size_t size, 196 enum GNUNET_BLOCK_Type type, size_t size, const void *data)
196 const void *data)
197{ 197{
198 GNUNET_HashCode original_key; /* Key data was stored data under */ 198 GNUNET_HashCode original_key; /* Key data was stored data under */
199 char original_data[4]; /* Made up data that was stored */ 199 char original_data[4]; /* Made up data that was stored */
200 memset(&original_key, 42, sizeof(GNUNET_HashCode)); /* Set the key to what it was set to previously */ 200
201 memset(original_data, 43, sizeof(original_data)); 201 memset (&original_key, 42, sizeof (GNUNET_HashCode)); /* Set the key to what it was set to previously */
202 memset (original_data, 43, sizeof (original_data));
202#if VERBOSE 203#if VERBOSE
203 unsigned int i; 204 unsigned int i;
204#endif 205#endif
205 206
206 if ((0 != memcmp(&original_key, key, sizeof (GNUNET_HashCode))) || (0 != memcmp(original_data, data, sizeof(original_data)))) 207 if ((0 != memcmp (&original_key, key, sizeof (GNUNET_HashCode))) ||
208 (0 != memcmp (original_data, data, sizeof (original_data))))
207 { 209 {
208 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Key or data is not the same as was inserted!\n"); 210 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
209 GNUNET_SCHEDULER_cancel(die_task); 211 "Key or data is not the same as was inserted!\n");
210 GNUNET_SCHEDULER_add_now(&end_badly, "key or data mismatch in get response!\n"); 212 GNUNET_SCHEDULER_cancel (die_task);
213 GNUNET_SCHEDULER_add_now (&end_badly,
214 "key or data mismatch in get response!\n");
211 return; 215 return;
212 } 216 }
213 217
214#if VERBOSE 218#if VERBOSE
215 if (put_path != NULL) 219 if (put_path != NULL)
216 { 220 {
217 fprintf(stderr, "PUT Path: "); 221 fprintf (stderr, "PUT Path: ");
218 for (i = 0; put_path[i] != NULL; i++) 222 for (i = 0; put_path[i] != NULL; i++)
219 fprintf(stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s(put_path[i])); 223 fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (put_path[i]));
220 fprintf(stderr, "\n"); 224 fprintf (stderr, "\n");
221 } 225 }
222 if (get_path != NULL) 226 if (get_path != NULL)
223 { 227 {
224 fprintf(stderr, "GET Path: "); 228 fprintf (stderr, "GET Path: ");
225 for (i = 0; get_path[i] != NULL; i++) 229 for (i = 0; get_path[i] != NULL; i++)
226 fprintf(stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s(get_path[i])); 230 fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (get_path[i]));
227 fprintf(stderr, "\n"); 231 fprintf (stderr, "\n");
228 } 232 }
229#endif 233#endif
230 234
231 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct GET response!\n"); 235 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct GET response!\n");
232 GNUNET_SCHEDULER_cancel(die_task); 236 GNUNET_SCHEDULER_cancel (die_task);
233 GNUNET_DHT_get_stop(global_get_handle); 237 GNUNET_DHT_get_stop (global_get_handle);
234 GNUNET_SCHEDULER_add_now (&finish_testing, NULL); 238 GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
235} 239}
236 240
@@ -238,18 +242,16 @@ void get_result_iterator (void *cls,
238 * Start the GET request for the same key/data that was inserted. 242 * Start the GET request for the same key/data that was inserted.
239 */ 243 */
240static void 244static void
241do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) 245do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
242{ 246{
243 GNUNET_HashCode key; /* Key for data lookup */ 247 GNUNET_HashCode key; /* Key for data lookup */
244 memset(&key, 42, sizeof(GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */ 248
245 global_get_handle = GNUNET_DHT_get_start(peer2dht, GNUNET_TIME_relative_get_forever(), 249 memset (&key, 42, sizeof (GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */
246 GNUNET_BLOCK_TYPE_TEST, 250 global_get_handle =
247 &key, 251 GNUNET_DHT_get_start (peer2dht, GNUNET_TIME_relative_get_forever (),
248 DEFAULT_GET_REPLICATION, 252 GNUNET_BLOCK_TYPE_TEST, &key,
249 GNUNET_DHT_RO_RECORD_ROUTE, 253 DEFAULT_GET_REPLICATION, GNUNET_DHT_RO_RECORD_ROUTE,
250 NULL, 0, 254 NULL, 0, NULL, 0, &get_result_iterator, NULL);
251 NULL, 0,
252 &get_result_iterator, NULL);
253} 255}
254 256
255/** 257/**
@@ -257,35 +259,37 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
257 * Schedule the GET request for some time in the future. 259 * Schedule the GET request for some time in the future.
258 */ 260 */
259static void 261static void
260put_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) 262put_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
261{ 263{
262 GNUNET_SCHEDULER_cancel (die_task); 264 GNUNET_SCHEDULER_cancel (die_task);
263 die_task = GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, 265 die_task = GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT,
264 &end_badly, "waiting for get response (data not found)"); 266 &end_badly,
265 GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10), &do_get, NULL); 267 "waiting for get response (data not found)");
268 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
269 (GNUNET_TIME_UNIT_SECONDS, 10), &do_get, NULL);
266} 270}
267 271
268/** 272/**
269 * Set up some data, and call API PUT function 273 * Set up some data, and call API PUT function
270 */ 274 */
271static void 275static void
272do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) 276do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
273{ 277{
274 GNUNET_HashCode key; /* Made up key to store data under */ 278 GNUNET_HashCode key; /* Made up key to store data under */
275 char data[4]; /* Made up data to store */ 279 char data[4]; /* Made up data to store */
276 memset(&key, 42, sizeof(GNUNET_HashCode)); /* Set the key to something simple so we can issue GET request */ 280
277 memset(data, 43, sizeof(data)); 281 memset (&key, 42, sizeof (GNUNET_HashCode)); /* Set the key to something simple so we can issue GET request */
282 memset (data, 43, sizeof (data));
278 283
279 /* Insert the data at the first peer */ 284 /* Insert the data at the first peer */
280 GNUNET_DHT_put(peer1dht, 285 GNUNET_DHT_put (peer1dht,
281 &key, 286 &key,
282 DEFAULT_PUT_REPLICATION, 287 DEFAULT_PUT_REPLICATION,
283 GNUNET_DHT_RO_RECORD_ROUTE, 288 GNUNET_DHT_RO_RECORD_ROUTE,
284 GNUNET_BLOCK_TYPE_TEST, 289 GNUNET_BLOCK_TYPE_TEST,
285 sizeof(data), data, 290 sizeof (data), data,
286 GNUNET_TIME_UNIT_FOREVER_ABS, 291 GNUNET_TIME_UNIT_FOREVER_ABS,
287 GNUNET_TIME_UNIT_FOREVER_REL, 292 GNUNET_TIME_UNIT_FOREVER_REL, &put_finished, NULL);
288 &put_finished, NULL);
289} 293}
290 294
291/** 295/**
@@ -309,43 +313,45 @@ topology_callback (void *cls,
309 const char *emsg) 313 const char *emsg)
310{ 314{
311 if (emsg == NULL) 315 if (emsg == NULL)
312 { 316 {
313 total_connections++; 317 total_connections++;
314#if VERBOSE 318#if VERBOSE
315 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "connected peer %s to peer %s, distance %u\n", 319 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
316 first_daemon->shortname, 320 "connected peer %s to peer %s, distance %u\n",
317 second_daemon->shortname, 321 first_daemon->shortname, second_daemon->shortname, distance);
318 distance);
319#endif 322#endif
320 } 323 }
321#if VERBOSE 324#if VERBOSE
322 else 325 else
323 { 326 {
324 failed_connections++; 327 failed_connections++;
325 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to connect peer %s to peer %s with error :\n%s\n", 328 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
326 first_daemon->shortname, 329 "Failed to connect peer %s to peer %s with error :\n%s\n",
327 second_daemon->shortname, emsg); 330 first_daemon->shortname, second_daemon->shortname, emsg);
328 } 331 }
329#endif 332#endif
330 333
331 if (total_connections == expected_connections) 334 if (total_connections == expected_connections)
332 { 335 {
333#if VERBOSE 336#if VERBOSE
334 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 337 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
335 "Created %d total connections, which is our target number! Starting next phase of testing.\n", 338 "Created %d total connections, which is our target number! Starting next phase of testing.\n",
336 total_connections); 339 total_connections);
337#endif 340#endif
338 GNUNET_SCHEDULER_cancel (die_task); 341 GNUNET_SCHEDULER_cancel (die_task);
339 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 342 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
340 &end_badly, "from test gets"); 343 &end_badly, "from test gets");
341 344
342 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 2), &do_put, NULL); 345 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
343 } 346 (GNUNET_TIME_UNIT_SECONDS, 2), &do_put, NULL);
347 }
344 else if (total_connections + failed_connections == expected_connections) 348 else if (total_connections + failed_connections == expected_connections)
345 { 349 {
346 GNUNET_SCHEDULER_cancel (die_task); 350 GNUNET_SCHEDULER_cancel (die_task);
347 die_task = GNUNET_SCHEDULER_add_now (&end_badly, "from topology_callback (too many failed connections)"); 351 die_task =
348 } 352 GNUNET_SCHEDULER_add_now (&end_badly,
353 "from topology_callback (too many failed connections)");
354 }
349} 355}
350 356
351 357
@@ -362,74 +368,74 @@ topology_callback (void *cls,
362 */ 368 */
363static void 369static void
364peers_started_callback (void *cls, 370peers_started_callback (void *cls,
365 const struct GNUNET_PeerIdentity *id, 371 const struct GNUNET_PeerIdentity *id,
366 const struct GNUNET_CONFIGURATION_Handle *cfg, 372 const struct GNUNET_CONFIGURATION_Handle *cfg,
367 struct GNUNET_TESTING_Daemon *d, const char *emsg) 373 struct GNUNET_TESTING_Daemon *d, const char *emsg)
368{ 374{
369 if (emsg != NULL) 375 if (emsg != NULL)
370 { 376 {
371 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to start daemon with error: `%s'\n", 377 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
372 emsg); 378 "Failed to start daemon with error: `%s'\n", emsg);
373 return; 379 return;
374 } 380 }
375 GNUNET_assert (id != NULL); 381 GNUNET_assert (id != NULL);
376 382
377 /* This is the first peer started */ 383 /* This is the first peer started */
378 if (peers_left == num_peers) 384 if (peers_left == num_peers)
379 { 385 {
380 memcpy(&peer1id, id, sizeof(struct GNUNET_PeerIdentity)); /* Save the peer id */ 386 memcpy (&peer1id, id, sizeof (struct GNUNET_PeerIdentity)); /* Save the peer id */
381 peer1dht = GNUNET_DHT_connect(cfg, 100); /* Connect to the first peers DHT service */ 387 peer1dht = GNUNET_DHT_connect (cfg, 100); /* Connect to the first peers DHT service */
382 if (peer1dht == NULL) /* If DHT connect failed */ 388 if (peer1dht == NULL) /* If DHT connect failed */
383 { 389 {
384 GNUNET_SCHEDULER_cancel (die_task); 390 GNUNET_SCHEDULER_cancel (die_task);
385 GNUNET_SCHEDULER_add_now(&end_badly, "Failed to get dht handle!\n"); 391 GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
386 } 392 }
387 } 393 }
388 else /* This is the second peer started */ 394 else /* This is the second peer started */
389 { 395 {
390 memcpy(&peer2id, id, sizeof(struct GNUNET_PeerIdentity)); /* Same as for first peer... */ 396 memcpy (&peer2id, id, sizeof (struct GNUNET_PeerIdentity)); /* Same as for first peer... */
391 peer2dht = GNUNET_DHT_connect(cfg, 100); 397 peer2dht = GNUNET_DHT_connect (cfg, 100);
392 if (peer2dht == NULL) 398 if (peer2dht == NULL)
393 { 399 {
394 GNUNET_SCHEDULER_cancel (die_task); 400 GNUNET_SCHEDULER_cancel (die_task);
395 GNUNET_SCHEDULER_add_now(&end_badly, "Failed to get dht handle!\n"); 401 GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
396 } 402 }
397 } 403 }
398 404
399 /* Decrement number of peers left to start */ 405 /* Decrement number of peers left to start */
400 peers_left--; 406 peers_left--;
401 407
402 if (peers_left == 0) /* Indicates all peers started */ 408 if (peers_left == 0) /* Indicates all peers started */
403 { 409 {
404#if VERBOSE 410#if VERBOSE
405 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 411 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
406 "All %d daemons started, now connecting peers!\n", 412 "All %d daemons started, now connecting peers!\n", num_peers);
407 num_peers);
408#endif 413#endif
409 expected_connections = -1; 414 expected_connections = -1;
410 if ((pg != NULL)) /* Sanity check */ 415 if ((pg != NULL)) /* Sanity check */
411 { 416 {
412 /* Connect peers in a "straight line" topology, return the number of expected connections */ 417 /* Connect peers in a "straight line" topology, return the number of expected connections */
413 expected_connections = GNUNET_TESTING_connect_topology (pg, 418 expected_connections = GNUNET_TESTING_connect_topology (pg,
414 GNUNET_TESTING_TOPOLOGY_LINE, 419 GNUNET_TESTING_TOPOLOGY_LINE,
415 GNUNET_TESTING_TOPOLOGY_OPTION_ALL, 420 GNUNET_TESTING_TOPOLOGY_OPTION_ALL,
416 0.0, 421 0.0,
417 TIMEOUT, 422 TIMEOUT,
418 2, 423 2, NULL, NULL);
419 NULL,
420 NULL);
421 }
422
423 /* Cancel current timeout fail task */
424 GNUNET_SCHEDULER_cancel (die_task);
425 if (expected_connections == GNUNET_SYSERR) /* Some error happened */
426 die_task = GNUNET_SCHEDULER_add_now (&end_badly, "from connect topology (bad return)");
427
428 /* Schedule timeout on failure task */
429 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
430 &end_badly, "from connect topology (timeout)");
431 ok = 0;
432 } 424 }
425
426 /* Cancel current timeout fail task */
427 GNUNET_SCHEDULER_cancel (die_task);
428 if (expected_connections == GNUNET_SYSERR) /* Some error happened */
429 die_task =
430 GNUNET_SCHEDULER_add_now (&end_badly,
431 "from connect topology (bad return)");
432
433 /* Schedule timeout on failure task */
434 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
435 &end_badly,
436 "from connect topology (timeout)");
437 ok = 0;
438 }
433} 439}
434 440
435static void 441static void
@@ -439,11 +445,13 @@ run (void *cls,
439{ 445{
440 446
441 /* Get path from configuration file */ 447 /* Get path from configuration file */
442 if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_string(cfg, "paths", "servicehome", &test_directory)) 448 if (GNUNET_YES !=
443 { 449 GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome",
444 ok = 404; 450 &test_directory))
445 return; 451 {
446 } 452 ok = 404;
453 return;
454 }
447 455
448 /* Get number of peers to start from configuration (should be two) */ 456 /* Get number of peers to start from configuration (should be two) */
449 if (GNUNET_SYSERR == 457 if (GNUNET_SYSERR ==
@@ -456,22 +464,19 @@ run (void *cls,
456 464
457 /* Set up a task to end testing if peer start fails */ 465 /* Set up a task to end testing if peer start fails */
458 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 466 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
459 &end_badly, "didn't start all daemons in reasonable amount of time!!!"); 467 &end_badly,
468 "didn't start all daemons in reasonable amount of time!!!");
460 469
461 /* Start num_peers peers, call peers_started_callback on peer start, topology_callback on peer connect */ 470 /* Start num_peers peers, call peers_started_callback on peer start, topology_callback on peer connect */
462 /* Read the API documentation for other parameters! */ 471 /* Read the API documentation for other parameters! */
463 pg = GNUNET_TESTING_daemons_start (cfg, 472 pg = GNUNET_TESTING_daemons_start (cfg, peers_left, /* Total number of peers */
464 peers_left, /* Total number of peers */ 473 peers_left, /* Number of outstanding connections */
465 peers_left, /* Number of outstanding connections */ 474 peers_left, /* Number of parallel ssh connections, or peers being started at once */
466 peers_left, /* Number of parallel ssh connections, or peers being started at once */
467 TIMEOUT, 475 TIMEOUT,
468 NULL, 476 NULL,
469 NULL, 477 NULL,
470 &peers_started_callback, 478 &peers_started_callback,
471 NULL, 479 NULL, &topology_callback, NULL, NULL);
472 &topology_callback,
473 NULL,
474 NULL);
475 480
476} 481}
477 482
@@ -479,10 +484,11 @@ static int
479check () 484check ()
480{ 485{
481 int ret; 486 int ret;
487
482 /* Arguments for GNUNET_PROGRAM_run */ 488 /* Arguments for GNUNET_PROGRAM_run */
483 char *const argv[] = {"test-dht-twopeer-put-get", /* Name to give running binary */ 489 char *const argv[] = { "test-dht-twopeer-put-get", /* Name to give running binary */
484 "-c", 490 "-c",
485 "test_dht_twopeer_data.conf", /* Config file to use */ 491 "test_dht_twopeer_data.conf", /* Config file to use */
486#if VERBOSE 492#if VERBOSE
487 "-L", "DEBUG", 493 "-L", "DEBUG",
488#endif 494#endif
@@ -493,12 +499,13 @@ check ()
493 }; 499 };
494 /* Run the run function as a new program */ 500 /* Run the run function as a new program */
495 ret = GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, 501 ret = GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
496 argv, "test-dht-twopeer-put-get", "nohelp", 502 argv, "test-dht-twopeer-put-get", "nohelp",
497 options, &run, &ok); 503 options, &run, &ok);
498 if (ret != GNUNET_OK) 504 if (ret != GNUNET_OK)
499 { 505 {
500 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "`test-dht-twopeer': Failed with error code %d\n", ret); 506 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
501 } 507 "`test-dht-twopeer': Failed with error code %d\n", ret);
508 }
502 return ok; 509 return ok;
503} 510}
504 511
@@ -520,9 +527,10 @@ main (int argc, char *argv[])
520 * of by the testing framework. 527 * of by the testing framework.
521 */ 528 */
522 if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK) 529 if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK)
523 { 530 {
524 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Failed to remove testing directory %s\n", test_directory); 531 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
525 } 532 "Failed to remove testing directory %s\n", test_directory);
533 }
526 return ret; 534 return ret;
527} 535}
528 536