aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-05-10 05:12:20 +0000
committerRoger Dingledine <arma@torproject.org>2007-05-10 05:12:20 +0000
commitcd23b65a0771ddfb1b40aae126a3abd2bf33dadf (patch)
treefa89337faec92a9d45826b13e981ad098230a0f2
parent8e8144cd5893c22b2b60bc1ad0ebda715848baec (diff)
downloadtor-cd23b65a0771ddfb1b40aae126a3abd2bf33dadf.tar.gz
tor-cd23b65a0771ddfb1b40aae126a3abd2bf33dadf.zip
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
-rw-r--r--doc/spec/dir-spec-v2.txt7
-rw-r--r--src/or/routerlist.c4
2 files changed, 8 insertions, 3 deletions
diff --git a/doc/spec/dir-spec-v2.txt b/doc/spec/dir-spec-v2.txt
index 2bc46c041d..f593999d9e 100644
--- a/doc/spec/dir-spec-v2.txt
+++ b/doc/spec/dir-spec-v2.txt
@@ -658,9 +658,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 e693090989..02c04a81ff 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2795,6 +2795,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.",
@@ -2809,16 +2810,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);