backport r10153 and r10156

svn:r10177
This commit is contained in:
Roger Dingledine 2007-05-13 00:46:50 +00:00
parent 2ded13ecdc
commit f597b73dc0
3 changed files with 21 additions and 6 deletions

View File

@ -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

View File

@ -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.

View File

@ -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;
}