diff options
author | Roger Dingledine <arma@torproject.org> | 2007-05-13 00:46:50 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2007-05-13 00:46:50 +0000 |
commit | f597b73dc0667910c60341780be1c811dc9380b1 (patch) | |
tree | 193337b4f7cd03feca0e999f20cbfdfe2fb3345a | |
parent | 2ded13ecdc3e102657daa0cc45d4c44602b5e327 (diff) | |
download | tor-f597b73dc0667910c60341780be1c811dc9380b1.tar.gz tor-f597b73dc0667910c60341780be1c811dc9380b1.zip |
backport r10153 and r10156
svn:r10177
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | doc/spec/dir-spec.txt | 7 | ||||
-rw-r--r-- | src/or/routerlist.c | 12 |
3 files changed, 21 insertions, 6 deletions
@@ -8,7 +8,13 @@ Changes in version 0.1.2.14 - 2007-0?-?? to corrupt memory under some really unlikely scenarios. - If a directory authority is down, skip it when deciding where to get networkstatus objects or descriptors. Otherwise we keep asking - every 10 seconds forever. + every 10 seconds forever. Fixes bug 384. + - Count it as a failure if we fetch a valid network-status but we + don't want to keep it. Otherwise we'll keep fetching it and keep + not wanting to keep it. Fixes part of bug 422. + - If all of our dirservers have given us bad or no networkstatuses + lately, then stop hammering them once per minute even when we + think they're failed. Fixes another part of bug 422. o Minor bugfixes: - Actually set the purpose correctly for descriptors inserted with diff --git a/doc/spec/dir-spec.txt b/doc/spec/dir-spec.txt index 9d7c399a3b..6d71cbf9f9 100644 --- a/doc/spec/dir-spec.txt +++ b/doc/spec/dir-spec.txt @@ -642,9 +642,10 @@ $Id$ When choosing which documents to download, clients treat their list of directory authorities as a circular ring, and begin with the authority appearing immediately after the authority for their most recently - retrieved network-status document. If this attempt fails, the client - retries at other caches several times, before moving on to the next - network-status document in sequence. + retrieved network-status document. If this attempt fails (either it + fails to download at all, or the one it gets is not as good as the + one it has), the client retries at other caches several times, before + moving on to the next network-status document in sequence. Clients discard all network-status documents over 24 hours old. diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 3cd450980f..ab47705cfc 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -2529,6 +2529,7 @@ router_set_networkstatus(const char *s, time_t arrived_at, ns->networkstatus_digest, DIGEST_LEN)) { /* Same one we had before. */ networkstatus_free(ns); + tor_assert(trusted_dir); log_info(LD_DIR, "Not replacing network-status from %s (published %s); " "we already have it.", @@ -2543,16 +2544,19 @@ router_set_networkstatus(const char *s, time_t arrived_at, } old_ns->received_on = arrived_at; } + ++trusted_dir->n_networkstatus_failures; return 0; } else if (old_ns->published_on >= ns->published_on) { char old_published[ISO_TIME_LEN+1]; format_iso_time(old_published, old_ns->published_on); + tor_assert(trusted_dir); log_info(LD_DIR, "Not replacing network-status from %s (published %s);" " we have a newer one (published %s) for this authority.", trusted_dir->description, published, old_published); networkstatus_free(ns); + ++trusted_dir->n_networkstatus_failures; return 0; } else { networkstatus_free(old_ns); @@ -2917,8 +2921,12 @@ update_networkstatus_client_downloads(time_t now) ds = smartlist_get(trusted_dir_servers, i); if (! ds->is_v2_authority) continue; - if (n_failed < n_dirservers && - ds->n_networkstatus_failures > NETWORKSTATUS_N_ALLOWABLE_FAILURES) { + if (n_failed >= n_dirservers) { + log_info(LD_DIR, "All authorities have failed. Not trying any."); + smartlist_free(missing); + return; + } + if (ds->n_networkstatus_failures > NETWORKSTATUS_N_ALLOWABLE_FAILURES) { ++n_failed; continue; } |