gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r13468 - gnunet/src/transport
Date: Fri, 29 Oct 2010 17:21:37 +0200

Author: wachs
Date: 2010-10-29 17:21:37 +0200 (Fri, 29 Oct 2010)
New Revision: 13468

Modified:
   gnunet/src/transport/Makefile.am
   gnunet/src/transport/test_quota_compliance.c
Log:
Added testcases for asymmetric quotas


Modified: gnunet/src/transport/Makefile.am
===================================================================
--- gnunet/src/transport/Makefile.am    2010-10-29 15:20:50 UTC (rev 13467)
+++ gnunet/src/transport/Makefile.am    2010-10-29 15:21:37 UTC (rev 13468)
@@ -18,11 +18,13 @@
  HTTP_PLUGIN_TEST = test_plugin_transport_http
  HTTP_API_TEST = test_transport_api_http
  HTTP_REL_TEST = test_transport_api_reliability_http
+ HTTP_QUOTA_TEST = test_quota_compliance_http
 
  HTTPS_PLUGIN_LA = libgnunet_plugin_transport_https.la
  HTTPS_PLUGIN_TEST = test_plugin_transport_https
  HTTPS_API_TEST = test_transport_api_https
- HTTPS_REL_TEST = test_transport_api_reliability_https                     
+ HTTPS_REL_TEST = test_transport_api_reliability_https
+ HTTPS_QUOTA_TEST = test_quota_compliance_https                      
 endif
 
 if USE_COVERAGE
@@ -202,9 +204,11 @@
  $(HTTP_REL_TEST) \
  $(HTTPS_REL_TEST) \
  test_quota_compliance_tcp \
- test_quota_compliance_http \
- test_quota_compliance_https \
- test_quota_compliance_udp
+ test_quota_compliance_tcp_asymmetric_recv_constant \
+ test_quota_compliance_tcp_asymmetric_send_constant \
+ test_quota_compliance_udp \
+ $(HTTP_QUOTA_TEST) \
+ $(HTTPS_QUOTA_TEST)
 # TODO: add tests for nat, etc.
 
 if !DISABLE_TEST_RUN
@@ -222,9 +226,11 @@
  $(HTTP_REL_TEST) \
  $(HTTPS_REL_TEST) \
  test_quota_compliance_tcp \
- test_quota_compliance_http \
- test_quota_compliance_https \
- test_quota_compliance_udp
+ test_quota_compliance_tcp_asymmetric_recv_constant \
+ test_quota_compliance_tcp_asymmetric_send_constant \
+ test_quota_compliance_udp \
+ $(HTTP_QUOTA_TEST) \
+ $(HTTPS_QUOTA_TEST)
 endif
 
 test_transport_api_tcp_SOURCES = \
@@ -317,6 +323,18 @@
  $(top_builddir)/src/transport/libgnunettransport.la \
  $(top_builddir)/src/util/libgnunetutil.la
 
+test_quota_compliance_tcp_asymmetric_recv_constant_SOURCES = \
+ test_quota_compliance.c
+test_quota_compliance_tcp_asymmetric_recv_constant_LDADD = \
+ $(top_builddir)/src/transport/libgnunettransport.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+ 
+ test_quota_compliance_tcp_asymmetric_send_constant_SOURCES = \
+ test_quota_compliance.c
+test_quota_compliance_tcp_asymmetric_send_constant_LDADD = \
+ $(top_builddir)/src/transport/libgnunettransport.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
 test_quota_compliance_http_SOURCES = \
  test_quota_compliance.c
 test_quota_compliance_http_LDADD = \
@@ -337,6 +355,7 @@
 
 endif
 
+
 EXTRA_DIST = \
   test_transport_api_data.conf \
   test_transport_api_tcp_peer1.conf \
@@ -364,4 +383,6 @@
   test_quota_compliance_http_peer1.conf \
   test_quota_compliance_http_peer2.conf \
   test_quota_compliance_https_peer1.conf \
-  test_quota_compliance_https_peer2.conf  
\ No newline at end of file
+  test_quota_compliance_https_peer2.conf \
+  test_quota_compliance_udp_peer1.conf \
+  test_quota_compliance_udp_peer2.conf
\ No newline at end of file

Modified: gnunet/src/transport/test_quota_compliance.c
===================================================================
--- gnunet/src/transport/test_quota_compliance.c        2010-10-29 15:20:50 UTC 
(rev 13467)
+++ gnunet/src/transport/test_quota_compliance.c        2010-10-29 15:21:37 UTC 
(rev 13468)
@@ -137,6 +137,8 @@
 static int is_http;
 static int is_https;
 static int is_udp;
+static int is_asymmetric_send_constant;
+static int is_asymmetric_recv_constant;
 
 static struct GNUNET_TIME_Absolute start_time;
 
@@ -397,7 +399,7 @@
          ok = 0;
   }
 
-  if (current_quota_p1 < MEASUREMENT_MIN_QUOTA)
+  if ((current_quota_p1 < MEASUREMENT_MIN_QUOTA) || (current_quota_p2 < 
MEASUREMENT_MIN_QUOTA))
   {
          end();
          return;
@@ -408,7 +410,12 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Scheduling next measurement\n");
 #endif
-       measure (current_quota_p1 / 10, current_quota_p2 / 10);
+   if (is_asymmetric_send_constant == GNUNET_YES)
+          measure (current_quota_p1 / 10, MEASUREMENT_MAX_QUOTA);
+   else if (is_asymmetric_recv_constant == GNUNET_YES)
+          measure (MEASUREMENT_MAX_QUOTA, current_quota_p2 / 10);
+   else
+          measure (current_quota_p1 / 10, current_quota_p2 / 10);
   }
 }
 
@@ -418,7 +425,7 @@
          current_quota_p2 = quota_p2;
 #if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Starting transport level measurement for %u seconds and quota 
%llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p1 / 1024);
+              "Starting transport level measurement for %u seconds and p1 
quota %llu kB/s p2 quota %llu\n", MEASUREMENT_INTERVALL.rel_value / 1000 , 
current_quota_p1 / 1024, current_quota_p2 / 1024);
 #endif
                GNUNET_TRANSPORT_set_quota (p1.th,
                          &p2.id,
@@ -580,21 +587,25 @@
 
   if (is_tcp)
     {
+         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing quota compliance for 
TCP transport plugin\n");
       setup_peer (&p1, "test_quota_compliance_tcp_peer1.conf");
       setup_peer (&p2, "test_quota_compliance_tcp_peer2.conf");
     }
   else if (is_http)
     {
+         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing quota compliance for 
HTTP transport plugin\n");
       setup_peer (&p1, "test_quota_compliance_http_peer1.conf");
       setup_peer (&p2, "test_quota_compliance_http_peer2.conf");
     }
   else if (is_https)
     {
+         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing quota compliance for 
HTTPS transport plugin\n");
       setup_peer (&p1, "test_quota_compliance_https_peer1.conf");
       setup_peer (&p2, "test_quota_compliance_https_peer2.conf");
     }
   else if (is_udp)
     {
+         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing quota compliance for 
UDP transport plugin\n");
       setup_peer (&p1, "test_quota_compliance_udp_peer1.conf");
       setup_peer (&p2, "test_quota_compliance_udp_peer2.conf");
     }
@@ -638,6 +649,7 @@
     {
       is_udp = GNUNET_YES;
     }
+
   GNUNET_log_setup ("test-quota-compliance",
 #if VERBOSE
                     "DEBUG",
@@ -657,6 +669,18 @@
     GNUNET_GETOPT_OPTION_END
   };
 
+  if (strstr(argv[0], "asymmetric_recv") != NULL)
+  {
+      is_asymmetric_recv_constant = GNUNET_YES;
+  }
+  else
+         is_asymmetric_recv_constant = GNUNET_NO;
+  if (strstr(argv[0], "asymmetric_send") != NULL)
+  {
+      is_asymmetric_send_constant = GNUNET_YES;
+  }
+  else
+         is_asymmetric_send_constant = GNUNET_NO;
   ok = 1;
   GNUNET_PROGRAM_run ((sizeof (argv1) / sizeof (char *)) - 1,
                       argv1, "test-quota-compliance", "nohelp",




reply via email to

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