[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-lib/master] Fix the logic what descriptors are left to download.
commit c0656d16ac5eabf4a75a9b9e51929b6e7b8d7d01
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Mon Jan 23 19:38:10 2012 +0100
Fix the logic what descriptors are left to download.
---
.../descriptor/impl/DownloadCoordinatorImpl.java | 34 ++++++++++++++------
1 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/src/org/torproject/descriptor/impl/DownloadCoordinatorImpl.java b/src/org/torproject/descriptor/impl/DownloadCoordinatorImpl.java
index 273655e..e91fd8b 100644
--- a/src/org/torproject/descriptor/impl/DownloadCoordinatorImpl.java
+++ b/src/org/torproject/descriptor/impl/DownloadCoordinatorImpl.java
@@ -229,16 +229,30 @@ public class DownloadCoordinatorImpl implements DownloadCoordinator {
if (response.getRequestEnd() != 0L) {
this.descriptorQueue.add(response);
}
- if ((!this.missingConsensus ||
- (this.downloadConsensusFromAllAuthorities &&
- this.requestedConsensuses.containsAll(
- 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
- * consensus requests to complete or fail, which results in adding
- * (failed) requests to the queue when we think we're done. */
+ boolean doneDownloading = true;
+ if ((this.missingConsensus ||
+ this.downloadConsensusFromAllAuthorities) &&
+ (!this.requestedConsensuses.containsAll(
+ this.directoryAuthorities.keySet()) ||
+ !this.requestingConsensuses.isEmpty())) {
+ doneDownloading = false;
+ }
+ if (!this.missingVotes.isEmpty()) {
+ if (!this.requestingVotes.isEmpty() ||
+ !this.requestedVotes.keySet().containsAll(
+ this.directoryAuthorities.keySet())) {
+ doneDownloading = false;
+ } else {
+ for (String missingVote : this.missingVotes) {
+ for (Set<String> reqVotes : this.requestedVotes.values()) {
+ if (!reqVotes.contains(missingVote)) {
+ doneDownloading = false;
+ }
+ }
+ }
+ }
+ }
+ if (doneDownloading) {
this.hasFinishedDownloading = true;
this.globalTimerThread.interrupt();
this.descriptorQueue.setOutOfDescriptors();
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits