gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r13445 - gnunet/src/transport
Date: Thu, 28 Oct 2010 16:08:23 +0200

Author: wachs
Date: 2010-10-28 16:08:22 +0200 (Thu, 28 Oct 2010)
New Revision: 13445

Modified:
   gnunet/src/transport/test_quota_compliance.c
Log:


Modified: gnunet/src/transport/test_quota_compliance.c
===================================================================
--- gnunet/src/transport/test_quota_compliance.c        2010-10-28 13:25:33 UTC 
(rev 13444)
+++ gnunet/src/transport/test_quota_compliance.c        2010-10-28 14:08:22 UTC 
(rev 13445)
@@ -42,14 +42,7 @@
 #define DEBUG_MEASUREMENT GNUNET_NO
 #define DEBUG_CONNECTIONS GNUNET_NO
 
-/**
- * Note that this value must not significantly exceed
- * 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise
- * messages may be dropped even for a reliable transport.
- */
-#define TOTAL_MSGS (10000 * 2)
-
-#define MEASUREMENT_INTERVALL GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 5)
+#define MEASUREMENT_INTERVALL GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 3)
 #define MEASUREMENT_MSG_SIZE 10000
 #define MEASUREMENT_MSG_SIZE_BIG 32768
 #define MEASUREMENT_MAX_QUOTA 1024 * 1024 * 1024
@@ -154,7 +147,14 @@
 #endif
 
 
+
 static void
+end_send ()
+{
+
+}
+
+static void
 end ()
 {
   GNUNET_SCHEDULER_cancel (sched, die_task);
@@ -244,6 +244,8 @@
 
   hdr = (const struct TestMessage*) message;
   s = get_size (n);
+  if (measurement_running == GNUNET_NO)
+         return;
   if (MTYPE != ntohs (message->type))
     return;
 #if DEBUG_MEASUREMENT
@@ -274,14 +276,18 @@
 
   if (buf == NULL)
     {
-      GNUNET_break (0);
       ok = 42;
       return 0;
     }
 
   if (measurement_running != GNUNET_YES)
+  {
+         send_running = GNUNET_NO;
+         end_send();
          return 0;
+  }
 
+  send_running = GNUNET_YES;
   ret = 0;
   s = get_size (n);
   GNUNET_assert (size >= s);
@@ -349,6 +355,7 @@
   measurement_running = GNUNET_NO;
   struct GNUNET_TIME_Relative duration = 
GNUNET_TIME_absolute_get_difference(start_time, GNUNET_TIME_absolute_get());
 
+
   if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK)
   {
     GNUNET_SCHEDULER_cancel (sched, measurement_counter_task);
@@ -357,11 +364,13 @@
 #if VERBOSE
   fprintf(stderr,"\n");
 #endif
+  /*
   if (transmit_handle != NULL)
   {
          GNUNET_TRANSPORT_notify_transmit_ready_cancel(transmit_handle);
          transmit_handle = NULL;
   }
+  */
   if ((total_bytes/(duration.rel_value / 1000)) > (current_quota_p1 + 
(current_quota_p1 / 10)))
   {
          GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -369,8 +378,8 @@
                          "Quota allowed: %10llu kB/s\n"\
                          "Throughput   : %10llu kB/s\n", (current_quota_p1 / 
(1024)) , (total_bytes/(duration.rel_value / 1000)/1024));
          ok = 1;
-         end();
-         return;
+/*       end();
+         return;*/
   }
   else
   {
@@ -381,11 +390,20 @@
                          "Throughput   : %10llu kB/s\n", (current_quota_p1 / 
(1024)) , (total_bytes/(duration.rel_value / 1000)/1024));
          ok = 0;
   }
+
   if (current_quota_p1 < MEASUREMENT_MIN_QUOTA)
+  {
          end();
+         return;
+  }
   else
-
-       measure (current_quota_p1 / 1024, current_quota_p2 / 1024);
+  {
+#if VERBOSE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Scheduling next measurement\n");
+#endif
+       measure (current_quota_p1 / 10, current_quota_p2 / 10);
+  }
 }
 
 static void measure (unsigned long long quota_p1, unsigned long long quota_p2 )
@@ -394,7 +412,7 @@
          current_quota_p2 = quota_p2;
 #if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Starting transport level measurement for %u and quota %llu 
kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p1 / 1024);
+              "Starting transport level measurement for %u seconds and quota 
%llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p1 / 1024);
 #endif
                GNUNET_TRANSPORT_set_quota (p1.th,
                          &p2.id,
@@ -430,7 +448,6 @@
 
                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 (0), 0, SEND_TIMEOUT,




reply via email to

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