[tor-commits] [tor/main] Ignore MAX_BANDWIDTH_CHANGE_FREQ on testing networks.

nickm at torproject.org nickm at torproject.org
Mon Jun 14 17:10:31 UTC 2021


commit 265cca935aefd1a3bdbe6abc964858e10fb4a029
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue May 11 15:54:14 2021 -0400

    Ignore MAX_BANDWIDTH_CHANGE_FREQ on testing networks.
    
    Part of the ever-growing 40337 fix.
---
 changes/ticket40337        | 3 +++
 src/feature/relay/router.c | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/changes/ticket40337 b/changes/ticket40337
index 02ea29ffc1..1c86fc4c99 100644
--- a/changes/ticket40337
+++ b/changes/ticket40337
@@ -11,3 +11,6 @@
       immediately from startup.  Previously, they waited
       until they had been running for a full day.   Closes ticket
       40337.
+    - Relays on testing networks no longer rate-limit how frequently
+      they are willing to report new bandwidth measurements. Part of a fix
+      for ticket 40337.
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 2696b8633b..c95f36aa8b 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -2599,7 +2599,10 @@ check_descriptor_bandwidth_changed(time_t now)
   if ((prev != cur && (!prev || !cur)) ||
       cur > (prev * BANDWIDTH_CHANGE_FACTOR) ||
       cur < (prev / BANDWIDTH_CHANGE_FACTOR) ) {
-    if (last_changed+MAX_BANDWIDTH_CHANGE_FREQ < now || !prev) {
+    const bool change_recent_enough =
+      last_changed+MAX_BANDWIDTH_CHANGE_FREQ < now;
+    const bool testing_network = get_options()->TestingTorNetwork;
+    if (change_recent_enough || testing_network || !prev) {
       log_info(LD_GENERAL,
                "Measured bandwidth has changed; rebuilding descriptor.");
       mark_my_descriptor_dirty("bandwidth has changed");





More information about the tor-commits mailing list