(no commit message)
authorMatthias Wachs <wachs@net.in.tum.de>
Mon, 17 Oct 2011 13:28:27 +0000 (13:28 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Mon, 17 Oct 2011 13:28:27 +0000 (13:28 +0000)
src/transport/test_quota_compliance.c
src/transport/test_quota_compliance_unix_asymmetric_peer1.conf
src/transport/test_quota_compliance_unix_asymmetric_peer2.conf
src/transport/test_quota_compliance_unix_peer1.conf
src/transport/test_quota_compliance_unix_peer2.conf
src/transport/test_transport_api_unix_peer2.conf

index 3422ef2fd3e76e79970727ae30f5a2bc49c936a5..2eacbd7650b867c669f5485623ccd53560d00a4a 100644 (file)
@@ -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
index f562d4c1a3edacc01c89cb3e8a89a9e079b1de70..649cf1c63a3c7f2802fcf24028bb3066da2fb863 100644 (file)
@@ -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
 
index b444cb48c18b48ced473fbed5279349dbaf8fefa..fa24517ee446069b916e4cb410845d1fc53d1be0 100644 (file)
@@ -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
index f562d4c1a3edacc01c89cb3e8a89a9e079b1de70..60e656bad43474dc294f745eec987ae258fce853 100644 (file)
@@ -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
-
-
-
index b444cb48c18b48ced473fbed5279349dbaf8fefa..42db979a2641fff776ca28e2897f030288451e87 100644 (file)
@@ -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
index 30b44e51d4dc74412053d4c2ef04d8b21b055752..a153588446502d280153486258c7e57f20c383dc 100644 (file)
@@ -25,5 +25,5 @@ PLUGINS = unix
 UNIXPATH = /tmp/gnunet-p2-service-transport.sock
 
 [transport-unix]
-PORT = 12131
+PORT = 12136