Skip to content
Snippets Groups Projects
Unverified Commit 96aadc69 authored by Georg Koppen's avatar Georg Koppen
Browse files

Merge remote-tracking branch 'gitlab/merge-requests/51' into maint-1.1

parents 38649f0f a050110d
No related branches found
No related tags found
No related merge requests found
......@@ -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__)
......@@ -251,12 +251,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):
......@@ -418,11 +412,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:
......
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment