Backport candidate: 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.


svn:r10153
This commit is contained in:
Roger Dingledine 2007-05-10 05:12:20 +00:00
parent 8e8144cd58
commit cd23b65a07
2 changed files with 8 additions and 3 deletions

View File

@ -658,9 +658,10 @@ $Id$
When choosing which documents to download, clients treat their list of When choosing which documents to download, clients treat their list of
directory authorities as a circular ring, and begin with the authority directory authorities as a circular ring, and begin with the authority
appearing immediately after the authority for their most recently appearing immediately after the authority for their most recently
retrieved network-status document. If this attempt fails, the client retrieved network-status document. If this attempt fails (either it
retries at other caches several times, before moving on to the next fails to download at all, or the one it gets is not as good as the
network-status document in sequence. 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. Clients discard all network-status documents over 24 hours old.

View File

@ -2795,6 +2795,7 @@ router_set_networkstatus(const char *s, time_t arrived_at,
ns->networkstatus_digest, DIGEST_LEN)) { ns->networkstatus_digest, DIGEST_LEN)) {
/* Same one we had before. */ /* Same one we had before. */
networkstatus_free(ns); networkstatus_free(ns);
tor_assert(trusted_dir);
log_info(LD_DIR, log_info(LD_DIR,
"Not replacing network-status from %s (published %s); " "Not replacing network-status from %s (published %s); "
"we already have it.", "we already have it.",
@ -2809,16 +2810,19 @@ router_set_networkstatus(const char *s, time_t arrived_at,
} }
old_ns->received_on = arrived_at; old_ns->received_on = arrived_at;
} }
++trusted_dir->n_networkstatus_failures;
return 0; return 0;
} else if (old_ns->published_on >= ns->published_on) { } else if (old_ns->published_on >= ns->published_on) {
char old_published[ISO_TIME_LEN+1]; char old_published[ISO_TIME_LEN+1];
format_iso_time(old_published, old_ns->published_on); format_iso_time(old_published, old_ns->published_on);
tor_assert(trusted_dir);
log_info(LD_DIR, log_info(LD_DIR,
"Not replacing network-status from %s (published %s);" "Not replacing network-status from %s (published %s);"
" we have a newer one (published %s) for this authority.", " we have a newer one (published %s) for this authority.",
trusted_dir->description, published, trusted_dir->description, published,
old_published); old_published);
networkstatus_free(ns); networkstatus_free(ns);
++trusted_dir->n_networkstatus_failures;
return 0; return 0;
} else { } else {
networkstatus_free(old_ns); networkstatus_free(old_ns);