From 7dfd634b17df4e1505c62f2224380a0d38da2e8d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 17 Nov 2011 19:18:52 +0000 Subject: add units to time, use configuration time api where appropriate, fixing Mantis #1875 --- src/testing/test_testing_2dtorus.conf | 8 +++--- src/testing/test_testing_data_topology_clique.conf | 4 +-- .../test_testing_data_topology_stability.conf | 2 +- src/testing/test_testing_large_topology.c | 25 +++++++++-------- src/testing/test_testing_peergroup_data.conf | 2 +- src/testing/test_testing_topology.c | 27 +++++++++---------- src/testing/test_testing_topology_blacklist.c | 12 +++------ src/testing/testing.conf | 2 +- src/testing/testing_peergroup.c | 31 +++++++++------------- 9 files changed, 51 insertions(+), 62 deletions(-) (limited to 'src/testing') diff --git a/src/testing/test_testing_2dtorus.conf b/src/testing/test_testing_2dtorus.conf index 8cf2f8f62..da5f90c9c 100644 --- a/src/testing/test_testing_2dtorus.conf +++ b/src/testing/test_testing_2dtorus.conf @@ -40,8 +40,8 @@ INTERNAL_ADDRESS = 127.0.0.1 EXTERNAL_ADDRESS = 127.0.0.1 [core] -TOTAL_QUOTA_IN = 999111999 -TOTAL_QUOTA_OUT = 999111999 +TOTAL_QUOTA_IN = 1 GB +TOTAL_QUOTA_OUT = 1 GB AUTOSTART = YES PORT = 10003 @@ -61,13 +61,13 @@ CONNECT_TOPOLOGY = 2D_TORUS #PERCENTAGE = 3 #PROBABILITY = .1 F2F = NO -CONNECT_TIMEOUT = 600 +CONNECT_TIMEOUT = 600 s CONNECT_ATTEMPTS = 2 DEBUG = YES HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat MAX_CONCURRENT_SSH = 10 USE_PROGRESSBARS = YES -PEERGROUP_TIMEOUT = 2400 +PEERGROUP_TIMEOUT = 2400 s TOPOLOGY_OUTPUT_FILE = testing_topo_initial MAX_OUTSTANDING_CONNECTIONS = 75 #SINGLE_PEERINFO_PER_HOST = YES diff --git a/src/testing/test_testing_data_topology_clique.conf b/src/testing/test_testing_data_topology_clique.conf index 168af17f4..69cecb7e9 100644 --- a/src/testing/test_testing_data_topology_clique.conf +++ b/src/testing/test_testing_data_topology_clique.conf @@ -3,8 +3,8 @@ DEFAULTCONFIG = test_testing_data_topology_clique.conf [TESTING] -CONNECT_TIMEOUT = 180 +CONNECT_TIMEOUT = 180 s CONNECT_ATTEMPTS = 14 NUM_PEERS = 4 TOPOLOGY = CLIQUE - +SETTLE_TIME = 0 diff --git a/src/testing/test_testing_data_topology_stability.conf b/src/testing/test_testing_data_topology_stability.conf index fc35fc8ab..1bfcd1bde 100644 --- a/src/testing/test_testing_data_topology_stability.conf +++ b/src/testing/test_testing_data_topology_stability.conf @@ -3,7 +3,7 @@ DEFAULTCONFIG = test_testing_data_topology_clique.conf [TESTING] -SETTLE_TIME = 600 +SETTLE_TIME = 600 s NUM_PEERS = 2 TOPOLOGY = CLIQUE diff --git a/src/testing/test_testing_large_topology.c b/src/testing/test_testing_large_topology.c index 78d91fa3d..a27154507 100644 --- a/src/testing/test_testing_large_topology.c +++ b/src/testing/test_testing_large_topology.c @@ -1043,26 +1043,25 @@ run (void *cls, char *const *args, const char *cfgfile, GNUNET_free_non_null (topology_str); GNUNET_free_non_null (blacklist_topology_str); - if (GNUNET_OK == - GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "settle_time", - &temp_settle)) - settle_time = - GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_settle); - + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "SETTLE_TIME", + &settle_time)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", + "testing", "SETTLE_TIME"); + return; + } if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers", &num_peers)) num_peers = DEFAULT_NUM_PEERS; - if (GNUNET_OK == - GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_timeout", - &temp_settle)) - connect_timeout = - GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_settle); - else + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "CONNECT_TIMEOUT", + &connect_timeout)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", - "testing", "connect_timeout"); + "testing", "CONNECT_TIMEOUT"); return; } diff --git a/src/testing/test_testing_peergroup_data.conf b/src/testing/test_testing_peergroup_data.conf index be734c7d2..6eadede95 100644 --- a/src/testing/test_testing_peergroup_data.conf +++ b/src/testing/test_testing_peergroup_data.conf @@ -6,7 +6,7 @@ DEFAULTCONFIG = test_testing_peergroup_data.conf CONNECT_ATTEMPTS = 2 MAX_OUTSTANDING_CONNECTIONS = 20 MAX_CONCURRENT_SSH = 1 -PEERGROUP_TIMEOUT = 300 +PEERGROUP_TIMEOUT = 300 s TOPOLOGY = CLIQUE PERCENTAGE = 0.5 PROBABILITY = 0.5 diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index deaeae457..ba092220a 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c @@ -999,7 +999,6 @@ run (void *cls, char *const *args, const char *cfgfile, char *blacklist_topology_str; char *connect_topology_option_str; char *connect_topology_option_modifier_string; - unsigned long long temp_settle; unsigned long long max_outstanding_connections; ok = 1; @@ -1101,21 +1100,21 @@ run (void *cls, char *const *args, const char *cfgfile, GNUNET_free_non_null (topology_str); GNUNET_free_non_null (blacklist_topology_str); - if (GNUNET_OK == - GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "settle_time", - &temp_settle)) - settle_time = - GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_settle); - - if (GNUNET_OK == - GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_timeout", - &temp_settle)) - connect_timeout = - GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_settle); - else + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "SETTLE_TIME", + &settle_time)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", + "testing", "SETTLE_TIME"); + return; + } + + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "CONNECT_TIMEOUT", + &connect_timeout)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", - "testing", "connect_timeout"); + "testing", "CONNECT_TIMEOUT"); return; } diff --git a/src/testing/test_testing_topology_blacklist.c b/src/testing/test_testing_topology_blacklist.c index 046cb2ca5..d53fc8cbe 100644 --- a/src/testing/test_testing_topology_blacklist.c +++ b/src/testing/test_testing_topology_blacklist.c @@ -390,7 +390,6 @@ run (void *cls, char *const *args, const char *cfgfile, unsigned long long connect_topology_num; unsigned long long blacklist_topology_num; unsigned long long connect_topology_option_num; - unsigned long long temp_connect; char *connect_topology_option_modifier_string; ok = 1; @@ -485,15 +484,12 @@ run (void *cls, char *const *args, const char *cfgfile, &num_peers)) num_peers = DEFAULT_NUM_PEERS; - if (GNUNET_OK == - GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_timeout", - &temp_connect)) - connect_timeout = - GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_connect); - else + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "CONNECT_TIMEOUT", + &connect_timeout)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", - "testing", "connect_timeout"); + "testing", "CONNECT_TIMEOUT"); return; } diff --git a/src/testing/testing.conf b/src/testing/testing.conf index 1604ebc3a..7e25f8c13 100644 --- a/src/testing/testing.conf +++ b/src/testing/testing.conf @@ -1,6 +1,6 @@ [TESTING] # How long before failing a connection? -CONNECT_TIMEOUT = 30 +CONNECT_TIMEOUT = 30 s # How many connect attempts should we make? CONNECT_ATTEMPTS = 3 # How many connections can happen simultaneously? 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 @@ #include "gnunet_disk_lib.h" /** Globals **/ -#define DEFAULT_CONNECT_TIMEOUT 30 // FIXME: use fancy time +#define DEFAULT_CONNECT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) #define DEFAULT_CONNECT_ATTEMPTS 2 @@ -55,7 +55,7 @@ struct PeerGroupStartupContext /** * How long to spend trying to establish all the connections? */ - unsigned long long connect_timeout; // FIXME: use fancy time + struct GNUNET_TIME_Relative connect_timeout; unsigned long long max_concurrent_ssh; struct GNUNET_TIME_Absolute timeout; @@ -508,10 +508,7 @@ internal_peers_started_callback (void *cls, pg_start_ctx->connect_topology, pg_start_ctx->connect_topology_option, pg_start_ctx->connect_topology_option_modifier, - // FIXME: use fancy time - GNUNET_TIME_relative_multiply( - GNUNET_TIME_UNIT_SECONDS, - pg_start_ctx->connect_timeout), + pg_start_ctx->connect_timeout, pg_start_ctx->connect_attempts, NULL, NULL); @@ -740,6 +737,7 @@ GNUNET_TESTING_peergroup_start (const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned long long temp_config_number; char *temp_str; int temp; + struct GNUNET_TIME_Relative rtimeout; GNUNET_assert (total > 0); GNUNET_assert (cfg != NULL); @@ -757,10 +755,10 @@ GNUNET_TESTING_peergroup_start (const struct GNUNET_CONFIGURATION_Handle *cfg, } if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_timeout", - &pg_start_ctx->connect_timeout)) + GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "CONNECT_TIMEOUT", + &pg_start_ctx->connect_timeout)) { - pg_start_ctx->connect_timeout = DEFAULT_CONNECT_TIMEOUT; + pg_start_ctx->connect_timeout = DEFAULT_CONNECT_TIMEOUT; } if (GNUNET_OK != @@ -796,21 +794,18 @@ GNUNET_TESTING_peergroup_start (const struct GNUNET_CONFIGURATION_Handle *cfg, return NULL; } - if (GNUNET_OK == + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "testing", - "peergroup_timeout", - &temp_config_number)) - pg_start_ctx->timeout = - GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply - (GNUNET_TIME_UNIT_SECONDS, - temp_config_number)); - else + "PEERGROUP_TIMEOUT", + &rtimeout)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", - "testing", "peergroup_timeout"); + "testing", "PEERGROUP_TIMEOUT"); GNUNET_free (pg_start_ctx); return NULL; } + pg_start_ctx->timeout = + GNUNET_TIME_relative_to_absolute (rtimeout); /* Read topology related options from the configuration file */ -- cgit v1.2.3