gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13900 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r13900 - gnunet/src/transport
Date: Tue, 14 Dec 2010 11:37:04 +0100

Author: wachs
Date: 2010-12-14 11:37:04 +0100 (Tue, 14 Dec 2010)
New Revision: 13900

Modified:
   gnunet/src/transport/test_quota_compliance.c
Log:
added counter to avoid single measurements failing to break the whole test


Modified: gnunet/src/transport/test_quota_compliance.c
===================================================================
--- gnunet/src/transport/test_quota_compliance.c        2010-12-13 21:04:59 UTC 
(rev 13899)
+++ gnunet/src/transport/test_quota_compliance.c        2010-12-14 10:37:04 UTC 
(rev 13900)
@@ -361,6 +361,7 @@
           const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   static int strike_counter;
+  static int failed_measurement_counter;
   unsigned long long  quota_allowed = 0;
   int delta = 0;
 
@@ -408,7 +409,10 @@
                          (total_bytes_sent/(duration.rel_value / 1000)/1024),
                          total_bytes_sent/(duration.rel_value / 1000));
          ok = 1;
-         end();
+         failed_measurement_counter--;
+         if (failed_measurement_counter < 0)
+                 end();
+         return;
   }
 
   /* Throughput is bigger than allowed quota + some extra*/
@@ -424,7 +428,9 @@
                          (total_bytes_sent/(duration.rel_value / 1000)/1024), 
                          total_bytes_sent/(duration.rel_value / 1000));
          ok = 1;
-         end();
+         failed_measurement_counter--;
+         if (failed_measurement_counter < 0)
+                 end();
          return;
   }
   else
@@ -433,12 +439,15 @@
                          "\nQuota compliance ok: \n"\
                          "Quota allowed: %10llu kB/s\n"\
                          "Throughput   : %10llu kB/s\n", (quota_allowed / 
(1024)) , (total_bytes_sent/(duration.rel_value / 1000)/1024));
+         if (failed_measurement_counter < 2)
+                 failed_measurement_counter++;
          ok = 0;
   }
 
   if ((quota_allowed) > (2 *(total_bytes_sent/(duration.rel_value / 1000))))
   {
-         strike_counter++;
+         if (failed_measurement_counter < 2)
+                 failed_measurement_counter++;
          if (strike_counter == 2)
          {
                  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -457,7 +466,6 @@
          end();
          return;
   }
-
   if (is_asymmetric_send_constant == GNUNET_YES)
   {
    if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]