Display the fingerprint when downloading consensuses from fallbacks

This commit is contained in:
teor 2016-12-07 16:02:17 +11:00
parent ced50aff7e
commit 9629a25d10
No known key found for this signature in database
GPG Key ID: 450CBA7F968F094B
2 changed files with 14 additions and 5 deletions

View File

@ -16,6 +16,12 @@
- Exclude relays affected by 20499 from the fallback list. Exclude known
affected versions, and any relay that delivers a stale consensus.
Closes ticket 20539.
- Require fallbacks to have flags for 90% of the time (weighted decaying
average), rather than 95%. This allows at least 73% of clients to
bootstrap in the first 5 seconds without contacting an authority.
Part of ticket 18828.
- Display the fingerprint when downloading consensuses from fallbacks.
Closes ticket 20908.
o Minor bugfix (fallback directories):
- Stop failing when OUTPUT_COMMENTS is True in updateFallbackDirs.py.
Closes ticket 20877; bugfix on commit 9998343 in tor-0.2.8.3-alpha.

View File

@ -1127,14 +1127,15 @@ class Candidate(object):
# log how long it takes to download a consensus from dirip:dirport
# returns True if the download failed, False if it succeeded within max_time
@staticmethod
def fallback_consensus_download_speed(dirip, dirport, nickname, max_time):
def fallback_consensus_download_speed(dirip, dirport, nickname, fingerprint,
max_time):
download_failed = False
start = datetime.datetime.utcnow()
# some directory mirrors respond to requests in ways that hang python
# sockets, which is why we log this line here
logging.info('Initiating %sconsensus download from %s (%s:%d).',
logging.info('Initiating %sconsensus download from %s (%s:%d) %s.',
'microdesc ' if DOWNLOAD_MICRODESC_CONSENSUS else '',
nickname, dirip, dirport)
nickname, dirip, dirport, fingerprint)
# there appears to be about 1 second of overhead when comparing stem's
# internal trace time and the elapsed time calculated here
TIMEOUT_SLOP = 1.0
@ -1171,9 +1172,9 @@ class Candidate(object):
else:
status = 'ok'
level = logging.DEBUG
logging.log(level, 'Consensus download: %0.1fs %s from %s (%s:%d), ' +
logging.log(level, 'Consensus download: %0.1fs %s from %s (%s:%d) %s, ' +
'max download time %0.1fs.', elapsed, status, nickname,
dirip, dirport, max_time)
dirip, dirport, fingerprint, max_time)
return download_failed
# does this fallback download the consensus fast enough?
@ -1185,12 +1186,14 @@ class Candidate(object):
ipv4_failed = Candidate.fallback_consensus_download_speed(self.dirip,
self.dirport,
self._data['nickname'],
self._fpr,
CONSENSUS_DOWNLOAD_SPEED_MAX)
if self.has_ipv6() and PERFORM_IPV6_DIRPORT_CHECKS:
# Clients assume the IPv6 DirPort is the same as the IPv4 DirPort
ipv6_failed = Candidate.fallback_consensus_download_speed(self.ipv6addr,
self.dirport,
self._data['nickname'],
self._fpr,
CONSENSUS_DOWNLOAD_SPEED_MAX)
return ((not ipv4_failed) and (not ipv6_failed))