From 2e30d52c8b5dfa6587b3cfc94ca035d51ff7b7af Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Mon, 17 Oct 2011 13:28:27 +0000 Subject: --- src/transport/test_quota_compliance.c | 33 +++++++++++----------- ...est_quota_compliance_unix_asymmetric_peer1.conf | 5 ++-- ...est_quota_compliance_unix_asymmetric_peer2.conf | 2 +- .../test_quota_compliance_unix_peer1.conf | 6 ++-- .../test_quota_compliance_unix_peer2.conf | 3 ++ src/transport/test_transport_api_unix_peer2.conf | 2 +- 6 files changed, 27 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 3422ef2fd..2eacbd765 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c @@ -36,7 +36,7 @@ #include "transport.h" #include "transport-testing.h" -#define VERBOSE GNUNET_EXTRA_LOGGING +#define VERBOSE GNUNET_YES #define VERBOSE_ARM GNUNET_EXTRA_LOGGING @@ -150,24 +150,21 @@ end () if (datarate > quota_in_p2) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Datarate of %llu higher than allowed inbound quota of %llu\n", datarate, quota_in_p2); + "Datarate of %llu b/s higher than allowed inbound quota of %llu b/s\n", datarate, quota_in_p2); test_failed = GNUNET_YES; } if (datarate > quota_out_p1) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Datarate of %llu higher than allowed outbound quota of %llu\n", datarate, quota_out_p1); + "Datarate of %llu b/s higher than allowed outbound quota of %llu b/s\n", datarate, quota_out_p1); test_failed = GNUNET_YES; } if (test_failed == GNUNET_NO) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Datarate of %llu complied to allowed outbound quota of %llu and inbound quota of %llu\n", datarate, quota_out_p1, quota_in_p2); + "Datarate of %llu b/s complied to allowed outbound quota of %llu b/s and inbound quota of %llu b/s\n", datarate, quota_out_p1, quota_in_p2); } - - - if (die_task != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel (die_task); @@ -189,6 +186,9 @@ end_badly () die_task = GNUNET_SCHEDULER_NO_TASK; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); + if (measure_task != GNUNET_SCHEDULER_NO_TASK) + GNUNET_SCHEDULER_cancel (measure_task); + if (test_connected == GNUNET_YES) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers got connected\n"); else @@ -462,20 +462,19 @@ void start_cb (struct PeerContext * p, } static char * -generate_config (char * cfg_file_p1, unsigned long long quota_in, unsigned long long quota_out) +generate_config (char * cfg_file, unsigned long long quota_in, unsigned long long quota_out) { char * fname = NULL; struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create(); - GNUNET_CONFIGURATION_load (cfg, cfg_file_p1); - - GNUNET_CONFIGURATION_set_value_number(cfg, "core", "TOTAL_QUOTA_IN", quota_in); + GNUNET_CONFIGURATION_load (cfg, cfg_file); + GNUNET_asprintf (&fname, "q_in_%u_q_out_%u_%s", quota_in, quota_out, cfg_file); + GNUNET_CONFIGURATION_set_value_string(cfg, "PATHS", "DEFAULTCONFIG", fname); GNUNET_CONFIGURATION_set_value_number(cfg, "core", "TOTAL_QUOTA_OUT", quota_out); - - GNUNET_asprintf (&fname, "q_in_%ull_q_out_%ull_%s", quota_in, quota_out, cfg_file_p1); - - GNUNET_CONFIGURATION_write(cfg, fname); + GNUNET_CONFIGURATION_set_value_number(cfg, "core", "TOTAL_QUOTA_IN", quota_in); + GNUNET_CONFIGURATION_set_value_number(cfg, "ats", "TOTAL_QUOTA_IN", quota_in); + GNUNET_CONFIGURATION_set_value_number(cfg, "ats", "TOTAL_QUOTA_OUT", quota_out); + GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_write(cfg, fname)); GNUNET_CONFIGURATION_destroy(cfg); - return fname; } @@ -551,7 +550,7 @@ check () { static char *argv[] = { "test_transport-quota-compliance", "-c", - "test_transport_api_data.conf", + "", #if VERBOSE "-L", "DEBUG", #endif diff --git a/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf b/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf index f562d4c1a..649cf1c63 100644 --- a/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf +++ b/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf @@ -1,7 +1,7 @@ @INLINE@ template_cfg_peer1.conf [PATHS] SERVICEHOME = /tmp/test_quota_compliance_peer1/ -DEFAULTCONFIG = test_quota_compliance_unix_peer1.conf +DEFAULTCONFIG = test_quota_compliance_unix_asymmetric_peer1.conf [arm] PORT = 4087 @@ -24,5 +24,6 @@ PORT = 4091 PLUGINS = unix UNIXPATH = /tmp/test_quota_compliance_unix_transport_peer1.sock - +[transport-unix] +PORT = 4092 diff --git a/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf b/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf index b444cb48c..fa24517ee 100644 --- a/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf +++ b/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf @@ -1,7 +1,7 @@ @INLINE@ template_cfg_peer1.conf [PATHS] SERVICEHOME = /tmp/test_quota_compliance_peer2 -DEFAULTCONFIG = test_quota_compliance_unix_peer2.conf +DEFAULTCONFIG = test_quota_compliance_unix_asymmetric_peer2.conf [arm] PORT = 3087 diff --git a/src/transport/test_quota_compliance_unix_peer1.conf b/src/transport/test_quota_compliance_unix_peer1.conf index f562d4c1a..60e656bad 100644 --- a/src/transport/test_quota_compliance_unix_peer1.conf +++ b/src/transport/test_quota_compliance_unix_peer1.conf @@ -3,6 +3,9 @@ SERVICEHOME = /tmp/test_quota_compliance_peer1/ DEFAULTCONFIG = test_quota_compliance_unix_peer1.conf +[transport-unix] +PORT = 12120 + [arm] PORT = 4087 UNIXPATH = /tmp/test_quota_compliance_unix_arm_peer1.sock @@ -23,6 +26,3 @@ UNIXPATH = /tmp/test_quota_compliance_unix_peerinfo_peer1.sock PORT = 4091 PLUGINS = unix UNIXPATH = /tmp/test_quota_compliance_unix_transport_peer1.sock - - - diff --git a/src/transport/test_quota_compliance_unix_peer2.conf b/src/transport/test_quota_compliance_unix_peer2.conf index b444cb48c..42db979a2 100644 --- a/src/transport/test_quota_compliance_unix_peer2.conf +++ b/src/transport/test_quota_compliance_unix_peer2.conf @@ -3,6 +3,9 @@ SERVICEHOME = /tmp/test_quota_compliance_peer2 DEFAULTCONFIG = test_quota_compliance_unix_peer2.conf +[transport-unix] +PORT = 12136 + [arm] PORT = 3087 UNIXPATH = /tmp/test_quota_compliance_unix_arm_peer2.sock diff --git a/src/transport/test_transport_api_unix_peer2.conf b/src/transport/test_transport_api_unix_peer2.conf index 30b44e51d..a15358844 100644 --- a/src/transport/test_transport_api_unix_peer2.conf +++ b/src/transport/test_transport_api_unix_peer2.conf @@ -25,5 +25,5 @@ PLUGINS = unix UNIXPATH = /tmp/gnunet-p2-service-transport.sock [transport-unix] -PORT = 12131 +PORT = 12136 -- cgit v1.2.3