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
+4
View File
@@ -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);