commit d5ecb5a3428c9c5df7544967b1acd17ae061879b Author: Karsten Loesing karsten.loesing@gmx.net Date: Tue Jan 17 11:20:35 2012 +0100
Fix a problem with downloading relay descriptors.
The consensus-health checker recently reported quite often that it couldn't download any consensuses. What happened was that the first directory authority immediately with an error. We decided that there's nothing to download anymore, because a) we requested the consensus from all authorities and didn't know about any votes yet that we could download. However, what we need to do is wait until all running consensus downloads finish. --- .../descriptor/impl/DownloadCoordinator.java | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/org/torproject/descriptor/impl/DownloadCoordinator.java b/src/org/torproject/descriptor/impl/DownloadCoordinator.java index c706415..49654d1 100644 --- a/src/org/torproject/descriptor/impl/DownloadCoordinator.java +++ b/src/org/torproject/descriptor/impl/DownloadCoordinator.java @@ -102,6 +102,10 @@ public class DownloadCoordinator { * hasn't tried downloading it before attempt to download it? */ private boolean missingConsensus = false;
+ /* Which directories are currently attempting to download the + * consensus? */ + private Set<String> requestingConsensuses = new HashSet<String>(); + /* Which directories have attempted to download the consensus so far, * including those directories that are currently attempting it? */ private Set<String> requestedConsensuses = new HashSet<String>(); @@ -136,6 +140,7 @@ public class DownloadCoordinator { if (!this.downloadConsensusFromAllAuthorities) { this.missingConsensus = false; } + this.requestingConsensuses.add(nickname); this.requestedConsensuses.add(nickname); request.setRequestedResource( "/tor/status-vote/current/consensus.z"); @@ -182,6 +187,7 @@ public class DownloadCoordinator { DescriptorRequestImpl response) { String nickname = response.getDirectoryNickname(); if (response.getDescriptorType().equals("consensus")) { + this.requestingConsensuses.remove(nickname); if (response.getResponseCode() == 200) { List<RelayNetworkStatusConsensus> parsedConsensuses = RelayNetworkStatusConsensusImpl.parseConsensuses( @@ -236,7 +242,8 @@ public class DownloadCoordinator { if ((!this.missingConsensus || (this.downloadConsensusFromAllAuthorities && this.requestedConsensuses.containsAll( - this.directoryAuthorities.keySet()))) && + this.directoryAuthorities.keySet()) && + this.requestingConsensuses.isEmpty())) && this.missingVotes.isEmpty() && this.requestingVotes.isEmpty()) { /* TODO This logic may be somewhat broken. We don't wait for all