[tor-commits] [metrics-lib/master] Fix the download logic some more.

karsten at torproject.org karsten at torproject.org
Tue Jan 31 08:55:40 UTC 2012


commit 2e62848ffa52c5d280d6738d416d0b56d3df3493
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Tue Jan 31 09:52:43 2012 +0100

    Fix the download logic some more.
    
    Yet another edge case was biting us.  When delivering responses, the
    download threads check whether there's more to download for anyone, and
    if not, they tell the client (here: DocTor).  This check was broken for
    directory authorities taking very long to download a consensus.  Fixed.
---
 .../descriptor/impl/DownloadCoordinatorImpl.java   |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/org/torproject/descriptor/impl/DownloadCoordinatorImpl.java b/src/org/torproject/descriptor/impl/DownloadCoordinatorImpl.java
index c10f468..b390b6d 100644
--- a/src/org/torproject/descriptor/impl/DownloadCoordinatorImpl.java
+++ b/src/org/torproject/descriptor/impl/DownloadCoordinatorImpl.java
@@ -253,16 +253,18 @@ public class DownloadCoordinatorImpl implements DownloadCoordinator {
     }
     if (!this.requestingVotes.isEmpty()) {
       doneDownloading = false;
-    } else if (!this.requestedVotes.keySet().containsAll(
-        this.runningDirectories)) {
-      doneDownloading = false;
     } else if (!this.missingVotes.isEmpty()) {
-      for (String missingVote : this.missingVotes) {
-        for (String runningDirectory : this.runningDirectories) {
-          Set<String> reqVotes = this.requestedVotes.get(
-              runningDirectory);
-          if (!reqVotes.contains(missingVote)) {
-            doneDownloading = false;
+      if (!this.requestedVotes.keySet().containsAll(
+          this.runningDirectories)) {
+        doneDownloading = false;
+      } else {
+        for (String missingVote : this.missingVotes) {
+          for (String runningDirectory : this.runningDirectories) {
+            Set<String> reqVotes = this.requestedVotes.get(
+                runningDirectory);
+            if (!reqVotes.contains(missingVote)) {
+              doneDownloading = false;
+            }
           }
         }
       }



More information about the tor-commits mailing list