GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still and

Commit fe8ecfef authored by juga  's avatar juga
Browse files

Merge branch 'maint-1.1'

parents f846c5d6 05bb23c5
......@@ -36,6 +36,14 @@ TORRC_STARTING_POINT = {
'SafeLogging': '0',
'LogTimeGranularity': '1',
'ProtocolWarnings': '1',
# To be able to responde to MaxAdvertisedBandwidth as soon as possible.
# If ``FetchDirInfoExtraEarly` is set, but not
# `FetchDirInfoEarly`, Tor will throw this error:
# `FetchDirInfoExtraEarly requires that you also set FetchDirInfoEarly`
'FetchDirInfoEarly': '1',
'FetchDirInfoExtraEarly': '1',
# To make Tor keep fetching descriptors, even when idle.
'FetchUselessDescriptors': '1'
# Options that need to be set at runtime.
......@@ -294,6 +294,17 @@ class Relay:
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):
"""Update this relay server descriptor (from the consensus."""
self._desc = server_descriptor
# XXX: tech-debt: replace `_ns` attr by a a `dequee` of the last
# router statuses seen for this relay and the timestampt.
def update_router_status(self, router_status):
"""Update this relay router status (from the consensus)."""
self._ns = router_status
class RelayList:
......@@ -439,9 +450,22 @@ class RelayList:
relays = copy.deepcopy(self._relays)
for r in relays:
if r.fingerprint in new_relays_dict.keys():
# If a relay in the previous consensus and is in the current
# one, update its timestamp, router status and descriptor.
fp = r.fingerprint
# new_relays_dict[fp] is the router status.
descriptor = c.get_server_descriptor(fp, default=None)
except (DescriptorUnavailable, ControllerError) as e:
log.exception("Exception trying to get desc %s", e)
# Add it to the new list of relays.
# And remove it from the new consensus dict, as it has
# already added to the new list.
# 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,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment