summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-04-07 22:55:46 +0000
committerNick Mathewson <nickm@torproject.org>2006-04-07 22:55:46 +0000
commit7a804572ab18c4de0e576e521d583a5fa07808ac (patch)
tree13c2833a9e6af1ff2651f25d3d93e054bfab9bef
parentc6d010b218e1694b0c165ba63d179e878ac6b4ea (diff)
downloadtor-7a804572ab18c4de0e576e521d583a5fa07808ac.tar.gz
tor-7a804572ab18c4de0e576e521d583a5fa07808ac.zip
fix an infinite loop; answer a question
svn:r6316
-rw-r--r--src/or/routerlist.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index e5504946ef..a7dbda2de9 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2408,13 +2408,17 @@ update_networkstatus_client_downloads(time_t now)
if (fetch_latest) {
int i;
- for (i = most_recent_idx + 1; i; ++i) {
+ int n_failed = 0;
+ for (i = most_recent_idx + 1; 1; ++i) {
trusted_dir_server_t *ds;
if (i >= n_dirservers)
i = 0;
ds = smartlist_get(trusted_dir_servers, i);
- if (ds->n_networkstatus_failures > NETWORKSTATUS_N_ALLOWABLE_FAILURES)
+ if (n_failed < n_dirservers &&
+ ds->n_networkstatus_failures > NETWORKSTATUS_N_ALLOWABLE_FAILURES) {
+ ++n_failed;
continue;
+ }
smartlist_add(missing, ds->digest);
break;
}
@@ -3579,7 +3583,11 @@ router_have_minimum_dir_info(void)
num_running++;
});
/* XXX if more than 3/4 of the routers in the network are down
- * or invalid, does this mean we'll never become happy? -RD */
+ * or invalid, does this mean we'll never become happy? -RD
+ * Right. We should base the required fraction on the number of
+ * routers we would like to download if we could. I think right now we
+ * only decline to download non-running routers, but we might want
+ * to split out the test so we can keep these in sync. -NM */
res = smartlist_len(routerlist->routers) >= (avg/4) && num_running > 2;
done:
if (res && !have_enough) {