From 215e37722461e7711caed40e221a9c7bd9d4f1ab Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 17 Mar 2006 04:41:57 +0000 Subject: [PATCH] Only warn about lack of name binding for self if we have tried downloading every networkstatus. svn:r6172 --- src/or/routerlist.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 2ab8f4d8e5..cf23c347ed 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -33,6 +33,7 @@ static void update_networkstatus_cache_downloads(time_t now); static void update_networkstatus_client_downloads(time_t now); static int signed_desc_digest_is_recognized(signed_descriptor_t *desc); static void routerlist_assert_ok(routerlist_t *rl); +static int have_tried_downloading_all_statuses(void); #define MAX_DESCRIPTORS_PER_ROUTER 5 @@ -2815,7 +2816,7 @@ routers_update_all_from_networkstatus(void) "consider sending your identity fingerprint to the tor-ops.", n_recent-n_valid, n_recent); have_warned_about_unverified_status = 1; - } else if (!n_named && n_naming) { // (n_named <= n_recent/2) { + } else if (!n_named && have_tried_downloading_all_statuses()) { log_warn(LD_GENERAL, "0/%d name-binding directory authorities " "recognize this server. Please consider sending your " "identity fingerprint to the tor-ops.", @@ -3691,6 +3692,26 @@ router_have_minimum_dir_info(void) return res; } +/** Return true iff we have downloaded, or attempted to download, a network + * status for each authority. */ +static int +have_tried_downloading_all_statuses(void) +{ + if (!trusted_dir_servers) + return 0; + + SMARTLIST_FOREACH(trusted_dir_servers, trusted_dir_server_t *, ds, + { + /* If we don't have the status, and we haven't failed to get the status, + * we haven't tried to get the status. */ + if (!networkstatus_get_by_digest(ds->digest) && + !ds->n_networkstatus_failures) + return 0; + }); + + return 1; +} + /** Reset the descriptor download failure count on all routers, so that we * can retry any long-failed routers immediately. */