aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-09-02 16:42:18 -0400
committerNick Mathewson <nickm@torproject.org>2010-09-02 16:46:03 -0400
commitbfa1962d8026e632e00760c1e14b39d154977adf (patch)
tree218e96b860a5fa4fa1baae7e1e316309e6c7502f /src/or/routerlist.c
parent6f9f1f3324d49ffbe0a5275a268111882ba8851f (diff)
downloadtor-bfa1962d8026e632e00760c1e14b39d154977adf.tar.gz
tor-bfa1962d8026e632e00760c1e14b39d154977adf.zip
Complicate the rules on WARN vs INFO in consensus verification
It's normal when bootstrapping to have a lot of different certs missing, so we don't want missing certs to make us warn... unless the certs we're missing are ones that we've tried to fetch a couple of times and failed at. May fix bug 1145.
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r--src/or/routerlist.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 8808f56db9..5bdc973b2c 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -440,6 +440,23 @@ authority_cert_dl_failed(const char *id_digest, int status)
download_status_failed(&cl->dl_status, status);
}
+/** Return true iff when we've been getting enough failures when trying to
+ * download the certificate with ID digest <b>id_digest</b> that we're willing
+ * to start bugging the user about it. */
+int
+authority_cert_dl_looks_uncertain(const char *id_digest)
+{
+#define N_AUTH_CERT_DL_FAILURES_TO_BUG_USER 2
+ cert_list_t *cl;
+ int n_failures;
+ if (!trusted_dir_certs ||
+ !(cl = digestmap_get(trusted_dir_certs, id_digest)))
+ return 0;
+
+ n_failures = download_status_get_n_failures(&cl->dl_status);
+ return n_failures >= N_AUTH_CERT_DL_FAILURES_TO_BUG_USER;
+}
+
/** How many times will we try to fetch a certificate before giving up? */
#define MAX_CERT_DL_FAILURES 8