diff options
author | teor <teor2345@gmail.com> | 2016-12-07 16:02:17 +1100 |
---|---|---|
committer | teor <teor2345@gmail.com> | 2016-12-19 15:05:33 +1100 |
commit | 9629a25d1019cffffc39f3982161b610eab5691f (patch) | |
tree | 661a0af68d41833ef80f8d4a0006e7bba125f66b /scripts/maint | |
parent | ced50aff7ee93326e18abae29c6e6bb99317a9a3 (diff) | |
download | tor-9629a25d1019cffffc39f3982161b610eab5691f.tar.gz tor-9629a25d1019cffffc39f3982161b610eab5691f.zip |
Display the fingerprint when downloading consensuses from fallbacks
Diffstat (limited to 'scripts/maint')
-rwxr-xr-x | scripts/maint/updateFallbackDirs.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/maint/updateFallbackDirs.py b/scripts/maint/updateFallbackDirs.py index 40b0056987..df5f049e34 100755 --- a/scripts/maint/updateFallbackDirs.py +++ b/scripts/maint/updateFallbackDirs.py @@ -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)) |