gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r13374 - gnunet/src/transport
Date: Fri, 22 Oct 2010 17:35:29 +0200

Author: wachs
Date: 2010-10-22 17:35:29 +0200 (Fri, 22 Oct 2010)
New Revision: 13374

Modified:
   gnunet/src/transport/test_quota_compliance.c
Log:
test now works


Modified: gnunet/src/transport/test_quota_compliance.c
===================================================================
--- gnunet/src/transport/test_quota_compliance.c        2010-10-22 14:51:29 UTC 
(rev 13373)
+++ gnunet/src/transport/test_quota_compliance.c        2010-10-22 15:35:29 UTC 
(rev 13374)
@@ -34,7 +34,7 @@
 #include "gnunet_transport_service.h"
 #include "transport.h"
 
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 #define VERBOSE_ARM GNUNET_NO
 
@@ -118,7 +118,7 @@
            GNUNET_SCHEDULER_cancel (sched, measurement_counter_task);
            measurement_counter_task = GNUNET_SCHEDULER_NO_TASK;
   }
-
+  GNUNET_SCHEDULER_shutdown (sched);
 #if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n");
 #endif
@@ -128,8 +128,7 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Transports disconnected, returning success!\n");
 #endif
-  ok = 0;
-
+  GNUNET_SCHEDULER_shutdown (sched);
 }
 
 
@@ -218,6 +217,9 @@
 
   transmit_handle = NULL;
 
+  if (measurement_task == GNUNET_SCHEDULER_NO_TASK)
+         return 0;
+
   if (buf == NULL)
     {
       GNUNET_break (0);
@@ -270,6 +272,7 @@
 
   if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
        return;
+
 #if VERBOSE
   fprintf(stderr,".");
 #endif
@@ -294,13 +297,29 @@
     GNUNET_SCHEDULER_cancel (sched, measurement_counter_task);
     measurement_counter_task = GNUNET_SCHEDULER_NO_TASK;
   }
-/*
+
   if (transmit_handle != NULL)
+  {
          GNUNET_TRANSPORT_notify_transmit_ready_cancel(transmit_handle);
-*/
-  fprintf (stderr, "\n");
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                 "Measurement finished: \n Quota allowed: %llu kb/s\n 
Throughput: %llu kb/s\n", (current_quota_p1 / (1024)) , 
(total_bytes/(duration.value / 1000)/1024));
+         transmit_handle = NULL;
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "\n Measurement finished: \n Quota allowed: %llu kb/s\n 
Throughput: %llu kb/s\n", (current_quota_p1 / (1024)) , 
(total_bytes/(duration.value / 1000)/1024));
+
+  if (current_quota_p1 < total_bytes/(duration.value / 1000))
+  {
+         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                         "\nQuota compliance failed: \n"\
+                         "Quota allowed: %llu kb/s\n"\
+                         "Throughput   : %llu kb/s\n", (current_quota_p1 / 
(1024)) , (total_bytes/(duration.value / 1000)/1024));
+         ok = 1;
+         end();
+         return;
+  }
+  else
+  {
+         ok = 0;
+  }
   if (current_quota_p1 < (MEASUREMENT_MIN_QUOTA))
          end();
   else
@@ -327,7 +346,11 @@
                          GNUNET_BANDWIDTH_value_init (current_quota_p2),
                          GNUNET_TIME_UNIT_FOREVER_REL,
                          NULL, NULL);
-               transmit_handle =GNUNET_TRANSPORT_notify_transmit_ready (p2.th,
+
+               if (transmit_handle != NULL)
+                         
GNUNET_TRANSPORT_notify_transmit_ready_cancel(transmit_handle);
+
+               transmit_handle = GNUNET_TRANSPORT_notify_transmit_ready (p2.th,
                                                                                
          &p1.id,
                                                                                
          get_size_new (0), 0, TIMEOUT,
                                                                                
          &notify_ready_new,
@@ -509,7 +532,6 @@
                       argv1, "test-quota-compliance", "nohelp",
                       options, &run, &ok);
   ret = ok;
-
   stop_arm (&p1);
   stop_arm (&p2);
   GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer1");




reply via email to

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