aboutsummaryrefslogtreecommitdiff
path: root/src/dht/test_dht_multipeer.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-30 01:06:19 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-30 01:06:19 +0000
commit793b4afffb37ca663e9a4fb6155dddd688b21b52 (patch)
tree1c5f2ca4e5ff08e5cab424ba3d418a3a1bab3ff8 /src/dht/test_dht_multipeer.c
parent25e636d19d7220430cac2a4fbdda0cac09f0b15d (diff)
downloadgnunet-793b4afffb37ca663e9a4fb6155dddd688b21b52.tar.gz
gnunet-793b4afffb37ca663e9a4fb6155dddd688b21b52.zip
re-add logging, move BF add operations to the latest possible time to avoid polluting tests needlessly
Diffstat (limited to 'src/dht/test_dht_multipeer.c')
-rw-r--r--src/dht/test_dht_multipeer.c56
1 files changed, 33 insertions, 23 deletions
diff --git a/src/dht/test_dht_multipeer.c b/src/dht/test_dht_multipeer.c
index 6f78dac2e..82d9aa55d 100644
--- a/src/dht/test_dht_multipeer.c
+++ b/src/dht/test_dht_multipeer.c
@@ -36,6 +36,9 @@
36/* Timeout for waiting for replies to get requests */ 36/* Timeout for waiting for replies to get requests */
37#define GET_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60) 37#define GET_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60)
38 38
39/* */
40#define START_DELAY GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60)
41
39/* Timeout for waiting for gets to complete */ 42/* Timeout for waiting for gets to complete */
40#define GET_DELAY GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 50) 43#define GET_DELAY GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 50)
41 44
@@ -554,35 +557,16 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
554} 557}
555 558
556 559
557
558/**
559 * This function is called once testing has finished setting up the topology.
560 *
561 * @param cls unused
562 * @param emsg variable is NULL on success (peers connected), and non-NULL on
563 * failure (peers failed to connect).
564 */
565static void 560static void
566run_dht_test (void *cls, const char *emsg) 561run_dht_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
567{ 562{
568 unsigned long long i; 563 unsigned long long i;
569 struct TestPutContext *test_put; 564 struct TestPutContext *test_put;
570 565
571 if (emsg != NULL)
572 {
573 fprintf (stderr,
574 "Failed to setup topology: %s\n",
575 emsg);
576 die_task =
577 GNUNET_SCHEDULER_add_now (&end_badly,
578 "topology setup failed");
579 return;
580 }
581
582#if PATH_TRACKING 566#if PATH_TRACKING
583 route_option = GNUNET_DHT_RO_RECORD_ROUTE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE; 567 route_option = GNUNET_DHT_RO_RECORD_ROUTE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE;
584#else 568#else
585 route_option = GNUNET_DHT_RO_NONE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE; 569 route_option = GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE;
586#endif 570#endif
587 die_task = 571 die_task =
588 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, 572 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
@@ -603,6 +587,32 @@ run_dht_test (void *cls, const char *emsg)
603} 587}
604 588
605 589
590/**
591 * This function is called once testing has finished setting up the topology.
592 *
593 * @param cls unused
594 * @param emsg variable is NULL on success (peers connected), and non-NULL on
595 * failure (peers failed to connect).
596 */
597static void
598startup_done (void *cls, const char *emsg)
599{
600 if (emsg != NULL)
601 {
602 fprintf (stderr,
603 "Failed to setup topology: %s\n",
604 emsg);
605 die_task =
606 GNUNET_SCHEDULER_add_now (&end_badly,
607 "topology setup failed");
608 return;
609 }
610 die_task =
611 GNUNET_SCHEDULER_add_delayed (START_DELAY, &run_dht_test,
612 "from setup puts/gets");
613}
614
615
606static void 616static void
607run (void *cls, char *const *args, const char *cfgfile, 617run (void *cls, char *const *args, const char *cfgfile,
608 const struct GNUNET_CONFIGURATION_Handle *cfg) 618 const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -624,7 +634,7 @@ run (void *cls, char *const *args, const char *cfgfile,
624 num_peers, 634 num_peers,
625 TIMEOUT, 635 TIMEOUT,
626 NULL, 636 NULL,
627 &run_dht_test, 637 &startup_done,
628 NULL, 638 NULL,
629 NULL); 639 NULL);
630 GNUNET_assert (NULL != pg); 640 GNUNET_assert (NULL != pg);