[or-cvs] [ernie/master] Download all missing relay descriptors, not only some.

karsten at torproject.org karsten at torproject.org
Wed Apr 14 14:33:20 UTC 2010


Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Wed, 14 Apr 2010 16:32:16 +0200
Subject: Download all missing relay descriptors, not only some.
Commit: f3eb09382f7bd3479b8fe33085afb6e7eddef0fe

---
 src/RelayDescriptorDownloader.java |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/RelayDescriptorDownloader.java b/src/RelayDescriptorDownloader.java
index c0d9696..00b0c4f 100644
--- a/src/RelayDescriptorDownloader.java
+++ b/src/RelayDescriptorDownloader.java
@@ -370,7 +370,7 @@ public class RelayDescriptorDownloader {
      * we got. In every iteration, compile a new list of URLs, remove
      * those that we tried before, and download the remaining ones. Stop
      * when there are no new URLs anymore. */
-    do {
+    while (true) {
 
       /* Compile list of URLs to download in this iteration. */
       urls.clear();
@@ -405,6 +405,11 @@ public class RelayDescriptorDownloader {
       }
       urls.removeAll(downloaded);
 
+      /* Stop if we don't have (new) URLs to download. */
+      if (urls.isEmpty()) {
+        break;
+      }
+
       for (String url : urls) {
         if (url.endsWith("consensus")) {
           this.triedConsensuses++;
@@ -489,7 +494,7 @@ public class RelayDescriptorDownloader {
         }
       }
       downloaded.addAll(urls);
-    } while (!urls.isEmpty());
+    }
   }
 
   public void writeFile() {
-- 
1.6.5



More information about the tor-commits mailing list