gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r36518 - gnunet/src/transport
Date: Sat, 17 Oct 2015 21:02:04 +0200

Author: grothoff
Date: 2015-10-17 21:02:04 +0200 (Sat, 17 Oct 2015)
New Revision: 36518

Modified:
   gnunet/src/transport/gnunet-service-transport_neighbours.c
Log:
-add option to ignore SetQuotaMessage (but still generate them), and if the 
option is not set, really do use the quotas consistently

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2015-10-17 
18:54:24 UTC (rev 36517)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2015-10-17 
19:02:04 UTC (rev 36518)
@@ -37,6 +37,11 @@
 #include "gnunet_constants.h"
 #include "transport.h"
 
+/**
+ * Experimental option to ignore SessionQuotaMessages from
+ * the other peer.
+ */
+#define IGNORE_INBOUND_QUOTA GNUNET_YES
 
 /**
  * Size of the neighbour hash map.
@@ -1177,7 +1182,8 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Setting inbound quota of %u Bps for peer `%s' to all clients\n",
               ntohl (quota.value__), GNUNET_i2s (&n->id));
-  GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker, quota);
+  GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker,
+                                         quota);
   if (0 != ntohl (quota.value__))
   {
     struct SessionQuotaMessage sqm;
@@ -1223,6 +1229,8 @@
                      struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
                      struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
 {
+  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_min;
+
   if (session == n->primary_address.session)
   {
     GST_validation_set_address_use (n->primary_address.address,
@@ -1236,11 +1244,14 @@
     if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__)
     {
       n->primary_address.bandwidth_out = bandwidth_out;
-      // FIXME: this ignores n->neighbour_receive_quota!
-      // -> might get 'unusually' high quota on initial
-      // connect
+#if IGNORE_INBOUND_QUOTA
+      bandwidth_min = bandwidth_out;
+#else
+      bandwidth_min = GNUNET_BANDWIDTH_value_min (bandwidth_out,
+                                                  n->neighbour_receive_quota);
+#endif
       send_outbound_quota_to_clients (&address->peer,
-                                      bandwidth_out);
+                                      bandwidth_min);
     }
     return;
   }
@@ -1277,11 +1288,14 @@
                                   GNUNET_YES);
   set_incoming_quota (n,
                       bandwidth_in);
-  // FIXME: this ignores n->neighbour_receive_quota!
-  // -> might get 'unusually' high quota on initial
-  // connect
+#if IGNORE_INBOUND_QUOTA
+  bandwidth_min = bandwidth_out;
+#else
+  bandwidth_min = GNUNET_BANDWIDTH_value_min (bandwidth_out,
+                                              n->neighbour_receive_quota);
+#endif
   send_outbound_quota_to_clients (&address->peer,
-                                  bandwidth_out);
+                                  bandwidth_min);
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Neighbour `%s' switched to address `%s'\n",
               GNUNET_i2s (&n->id),
@@ -2558,8 +2572,12 @@
   if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__)
   {
     n->primary_address.bandwidth_out = bandwidth_out;
+#if IGNORE_INBOUND_QUOTA
+    bandwidth_min = bandwidth_out;
+#else
     bandwidth_min = GNUNET_BANDWIDTH_value_min (bandwidth_out,
                                                 n->neighbour_receive_quota);
+#endif
     send_outbound_quota_to_clients (&address->peer,
                                     bandwidth_min);
   }
@@ -3696,9 +3714,12 @@
   n->neighbour_receive_quota
     = GNUNET_BANDWIDTH_value_max (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
                                   GNUNET_BANDWIDTH_value_init (ntohl 
(sqm->quota)));
-
+#if IGNORE_INBOUND_QUOTA
+  bandwidth_min = n->primary_address.bandwidth_out;
+#else
   bandwidth_min = GNUNET_BANDWIDTH_value_min (n->primary_address.bandwidth_out,
                                               n->neighbour_receive_quota);
+#endif
   send_outbound_quota_to_clients (peer,
                                   bandwidth_min);
 }




reply via email to

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