aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_peergroup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_peergroup.c')
-rw-r--r--src/testing/testing_peergroup.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/testing/testing_peergroup.c b/src/testing/testing_peergroup.c
index 837b50c08..0923dfc50 100644
--- a/src/testing/testing_peergroup.c
+++ b/src/testing/testing_peergroup.c
@@ -33,7 +33,7 @@
33#include "gnunet_disk_lib.h" 33#include "gnunet_disk_lib.h"
34 34
35/** Globals **/ 35/** Globals **/
36#define DEFAULT_CONNECT_TIMEOUT 30 // FIXME: use fancy time 36#define DEFAULT_CONNECT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
37 37
38#define DEFAULT_CONNECT_ATTEMPTS 2 38#define DEFAULT_CONNECT_ATTEMPTS 2
39 39
@@ -55,7 +55,7 @@ struct PeerGroupStartupContext
55 /** 55 /**
56 * How long to spend trying to establish all the connections? 56 * How long to spend trying to establish all the connections?
57 */ 57 */
58 unsigned long long connect_timeout; // FIXME: use fancy time 58 struct GNUNET_TIME_Relative connect_timeout;
59 59
60 unsigned long long max_concurrent_ssh; 60 unsigned long long max_concurrent_ssh;
61 struct GNUNET_TIME_Absolute timeout; 61 struct GNUNET_TIME_Absolute timeout;
@@ -508,10 +508,7 @@ internal_peers_started_callback (void *cls,
508 pg_start_ctx->connect_topology, 508 pg_start_ctx->connect_topology,
509 pg_start_ctx->connect_topology_option, 509 pg_start_ctx->connect_topology_option,
510 pg_start_ctx->connect_topology_option_modifier, 510 pg_start_ctx->connect_topology_option_modifier,
511 // FIXME: use fancy time 511 pg_start_ctx->connect_timeout,
512 GNUNET_TIME_relative_multiply(
513 GNUNET_TIME_UNIT_SECONDS,
514 pg_start_ctx->connect_timeout),
515 pg_start_ctx->connect_attempts, NULL, 512 pg_start_ctx->connect_attempts, NULL,
516 NULL); 513 NULL);
517 514
@@ -740,6 +737,7 @@ GNUNET_TESTING_peergroup_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
740 unsigned long long temp_config_number; 737 unsigned long long temp_config_number;
741 char *temp_str; 738 char *temp_str;
742 int temp; 739 int temp;
740 struct GNUNET_TIME_Relative rtimeout;
743 741
744 GNUNET_assert (total > 0); 742 GNUNET_assert (total > 0);
745 GNUNET_assert (cfg != NULL); 743 GNUNET_assert (cfg != NULL);
@@ -757,10 +755,10 @@ GNUNET_TESTING_peergroup_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
757 } 755 }
758 756
759 if (GNUNET_OK != 757 if (GNUNET_OK !=
760 GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_timeout", 758 GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "CONNECT_TIMEOUT",
761 &pg_start_ctx->connect_timeout)) 759 &pg_start_ctx->connect_timeout))
762 { 760 {
763 pg_start_ctx->connect_timeout = DEFAULT_CONNECT_TIMEOUT; 761 pg_start_ctx->connect_timeout = DEFAULT_CONNECT_TIMEOUT;
764 } 762 }
765 763
766 if (GNUNET_OK != 764 if (GNUNET_OK !=
@@ -796,21 +794,18 @@ GNUNET_TESTING_peergroup_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
796 return NULL; 794 return NULL;
797 } 795 }
798 796
799 if (GNUNET_OK == 797 if (GNUNET_OK !=
800 GNUNET_CONFIGURATION_get_value_number (cfg, "testing", 798 GNUNET_CONFIGURATION_get_value_number (cfg, "testing",
801 "peergroup_timeout", 799 "PEERGROUP_TIMEOUT",
802 &temp_config_number)) 800 &rtimeout))
803 pg_start_ctx->timeout =
804 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply
805 (GNUNET_TIME_UNIT_SECONDS,
806 temp_config_number));
807 else
808 { 801 {
809 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", 802 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
810 "testing", "peergroup_timeout"); 803 "testing", "PEERGROUP_TIMEOUT");
811 GNUNET_free (pg_start_ctx); 804 GNUNET_free (pg_start_ctx);
812 return NULL; 805 return NULL;
813 } 806 }
807 pg_start_ctx->timeout =
808 GNUNET_TIME_relative_to_absolute (rtimeout);
814 809
815 810
816 /* Read topology related options from the configuration file */ 811 /* Read topology related options from the configuration file */