[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [sbws/master] fix: relaylist: Stop measuring relays not in the consenus
commit a050110db59d136f6f46809c4b18fe487012e546
Author: juga0 <juga@xxxxxxxxxx>
Date: Mon Dec 21 16:24:50 2020 +0000
fix: relaylist: Stop measuring relays not in the consenus
as this might cause many circuit errors.
They're already added to the generator.
Also adapt the number in test_init_relays.
Closes: #40037.
Happy solstice! :)
---
sbws/lib/relaylist.py | 17 +++++------------
tests/unit/lib/test_relaylist.py | 8 ++++----
2 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py
index 8a07ce7..640e3eb 100644
--- a/sbws/lib/relaylist.py
+++ b/sbws/lib/relaylist.py
@@ -14,7 +14,7 @@ from ..globals import (
MAX_RECENT_PRIORITY_LIST_COUNT,
MEASUREMENTS_PERIOD
)
-from ..util import timestamp, timestamps
+from ..util import timestamps
log = logging.getLogger(__name__)
@@ -250,12 +250,6 @@ class Relay:
def relay_recent_priority_list_count(self):
return len(self.relay_recent_priority_list)
- def is_old(self):
- """Whether the last consensus seen for this relay is older than the
- measurement period.
- """
- return timestamp.is_old(self.last_consensus_timestamp)
-
# XXX: tech-debt: replace `_desc` attr by a a `dequee` of the last
# descriptors seen for this relay and the timestamp.
def update_server_descriptor(self, server_descriptor):
@@ -417,11 +411,10 @@ class RelayList:
# already added to the new list.
new_relays_dict.pop(fp)
- # If the relay is not in the current consensus but is not "old"
- # yet, add it to the new list of relays too, though its timestamp,
- # router status and descriptor can't be updated.
- elif not r.is_old():
- new_relays.append(r)
+ # In #30727, the relay that is not in the current conensus but is
+ # not "old", was added to the new list of relays too.
+ # In #40037 we think it should not be measured, as it might cause
+ # many circuit errors. It's already added to the generator.
# Otherwise, don't add it to the new list of relays.
# For debugging, count the old relays that will be discarded.
else:
diff --git a/tests/unit/lib/test_relaylist.py b/tests/unit/lib/test_relaylist.py
index 31673ba..399d897 100644
--- a/tests/unit/lib/test_relaylist.py
+++ b/tests/unit/lib/test_relaylist.py
@@ -51,7 +51,7 @@ def test_init_relays(
assert 6505 == 6433 + len(added_fps)
# The calculated min bw for the second hop
assert 2120000 == relay_list._exit_min_bw
- assert 200000 == relay_list._non_exit_min_bw
+ assert 210000 == relay_list._non_exit_min_bw
# Five days later plus 1 second.
# The first consensus timestamp will get removed.
@@ -69,10 +69,10 @@ def test_init_relays(
removed_fps = fps.difference(fps_5days_later)
# The number of relays will be the number of relays in the cosensus plus
# the added ones minus the removed ones.
- assert 6925 == 6505 + len(added_fps) - len(removed_fps)
+ assert 6596 == 6505 + len(added_fps) - len(removed_fps)
# The calculated min bw for the second hop
- assert 2790000 == relay_list._exit_min_bw
- assert 110000 == relay_list._non_exit_min_bw
+ assert 2800000 == relay_list._exit_min_bw
+ assert 150000 == relay_list._non_exit_min_bw
def test_increment_recent_measurement_attempt(args, conf, controller):
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits