aboutsummaryrefslogtreecommitdiff
path: root/src/dht/test_dht_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
commit5746309cb4be2073d550ad7a6885e918631dbc38 (patch)
tree89455bc4aadf977816b38df13f990372cd81d71a /src/dht/test_dht_api.c
parent6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff)
downloadgnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz
gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip
indentation
Diffstat (limited to 'src/dht/test_dht_api.c')
-rw-r--r--src/dht/test_dht_api.c53
1 files changed, 23 insertions, 30 deletions
diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c
index 407e2279b..9fc5c2d7a 100644
--- a/src/dht/test_dht_api.c
+++ b/src/dht/test_dht_api.c
@@ -237,8 +237,8 @@ test_find_peer_processor (void *cls, const struct GNUNET_HELLO_Message *hello)
237 * @param cls closure 237 * @param cls closure
238 * @param tc context information (why was this task triggered now?) 238 * @param tc context information (why was this task triggered now?)
239 */ 239 */
240void 240void retry_find_peer_stop (void *cls,
241retry_find_peer_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); 241 const struct GNUNET_SCHEDULER_TaskContext *tc);
242 242
243/** 243/**
244 * Retry the find_peer task on timeout. 244 * Retry the find_peer task on timeout.
@@ -330,8 +330,7 @@ test_find_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
330 retry_context.next_timeout = BASE_TIMEOUT; 330 retry_context.next_timeout = BASE_TIMEOUT;
331 retry_context.peer_ctx = peer; 331 retry_context.peer_ctx = peer;
332 332
333 peer->find_peer_handle 333 peer->find_peer_handle =
334 =
335 GNUNET_DHT_find_peer_start (peer->dht_handle, retry_context.next_timeout, 334 GNUNET_DHT_find_peer_start (peer->dht_handle, retry_context.next_timeout,
336 &hash, GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, 335 &hash, GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE,
337 &test_find_peer_processor, &retry_context); 336 &test_find_peer_processor, &retry_context);
@@ -374,8 +373,7 @@ test_get_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
374} 373}
375 374
376void 375void
377test_get_iterator (void *cls, 376test_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
378 struct GNUNET_TIME_Absolute exp,
379 const GNUNET_HashCode * key, 377 const GNUNET_HashCode * key,
380 const struct GNUNET_PeerIdentity *const *get_path, 378 const struct GNUNET_PeerIdentity *const *get_path,
381 const struct GNUNET_PeerIdentity *const *put_path, 379 const struct GNUNET_PeerIdentity *const *put_path,
@@ -409,13 +407,10 @@ test_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
409 retry_context.next_timeout = BASE_TIMEOUT; 407 retry_context.next_timeout = BASE_TIMEOUT;
410 408
411 peer->get_handle = 409 peer->get_handle =
412 GNUNET_DHT_get_start (peer->dht_handle, 410 GNUNET_DHT_get_start (peer->dht_handle, TOTAL_TIMEOUT,
413 TOTAL_TIMEOUT, 411 GNUNET_BLOCK_TYPE_TEST, &hash,
414 GNUNET_BLOCK_TYPE_TEST, 412 DEFAULT_GET_REPLICATION, GNUNET_DHT_RO_NONE, NULL,
415 &hash, 413 0, NULL, 0, &test_get_iterator, NULL);
416 DEFAULT_GET_REPLICATION,
417 GNUNET_DHT_RO_NONE,
418 NULL, 0, NULL, 0, &test_get_iterator, NULL);
419 414
420 if (peer->get_handle == NULL) 415 if (peer->get_handle == NULL)
421 { 416 {
@@ -450,11 +445,8 @@ test_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
450 445
451 GNUNET_assert (peer->dht_handle != NULL); 446 GNUNET_assert (peer->dht_handle != NULL);
452 447
453 GNUNET_DHT_put (peer->dht_handle, &hash, 448 GNUNET_DHT_put (peer->dht_handle, &hash, DEFAULT_PUT_REPLICATION,
454 DEFAULT_PUT_REPLICATION, 449 GNUNET_DHT_RO_NONE, GNUNET_BLOCK_TYPE_TEST, data_size, data,
455 GNUNET_DHT_RO_NONE,
456 GNUNET_BLOCK_TYPE_TEST,
457 data_size, data,
458 GNUNET_TIME_relative_to_absolute (TOTAL_TIMEOUT), 450 GNUNET_TIME_relative_to_absolute (TOTAL_TIMEOUT),
459 TOTAL_TIMEOUT, &test_get, &p1); 451 TOTAL_TIMEOUT, &test_get, &p1);
460 GNUNET_free (data); 452 GNUNET_free (data);
@@ -465,28 +457,29 @@ setup_peer (struct PeerContext *p, const char *cfgname)
465{ 457{
466 p->cfg = GNUNET_CONFIGURATION_create (); 458 p->cfg = GNUNET_CONFIGURATION_create ();
467#if START_ARM 459#if START_ARM
468 p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", 460 p->arm_proc =
469 "gnunet-service-arm", 461 GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
462 "gnunet-service-arm",
470#if VERBOSE_ARM 463#if VERBOSE_ARM
471 "-L", "DEBUG", 464 "-L", "DEBUG",
472#endif 465#endif
473 "-c", cfgname, NULL); 466 "-c", cfgname, NULL);
474#endif 467#endif
475 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 468 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
476 469
477} 470}
478 471
479static void 472static void
480run (void *cls, 473run (void *cls, char *const *args, const char *cfgfile,
481 char *const *args, 474 const struct GNUNET_CONFIGURATION_Handle *cfg)
482 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
483{ 475{
484 GNUNET_assert (ok == 1); 476 GNUNET_assert (ok == 1);
485 OKPP; 477 OKPP;
486 478
487 die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 479 die_task =
488 (GNUNET_TIME_UNIT_MINUTES, 1), 480 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
489 &end_badly, NULL); 481 (GNUNET_TIME_UNIT_MINUTES, 1), &end_badly,
482 NULL);
490 483
491 setup_peer (&p1, "test_dht_api_peer1.conf"); 484 setup_peer (&p1, "test_dht_api_peer1.conf");
492 485
@@ -512,8 +505,8 @@ check ()
512 }; 505 };
513 506
514 ok = 1; 507 ok = 1;
515 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, 508 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
516 argv, "test-dht-api", "nohelp", options, &run, &ok); 509 "test-dht-api", "nohelp", options, &run, &ok);
517 stop_arm (&p1); 510 stop_arm (&p1);
518 return ok; 511 return ok;
519} 512}