diff options
author | Roger Dingledine <arma@torproject.org> | 2008-06-05 10:57:09 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2008-06-05 10:57:09 +0000 |
commit | ca416a78e3570a62bf471abde8432208a660f8c5 (patch) | |
tree | e3abf59baea1cd08b1f0dbcb2feb751bde28e4ec | |
parent | 6782682ac6f7f8fc7a3f412ae606d5b21de459d1 (diff) | |
download | tor-ca416a78e3570a62bf471abde8432208a660f8c5.tar tor-ca416a78e3570a62bf471abde8432208a660f8c5.tar.gz |
When we switched to using v3 directories, we threw away the part of
the "do we have enough directory info?" calculation that checked
how many relays we believed to still be running based on our own
experience. So if we went offline, we never gave up trying to make
new circuits; worse, when we came back online we didn't recognize
that we should give all the relays another chance. Bugfix on
0.2.0.9-alpha; fixes bugs 648 and 675.
svn:r14970
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | src/or/routerlist.c | 21 |
2 files changed, 22 insertions, 8 deletions
@@ -1,4 +1,13 @@ Changes in version 0.2.1.1-alpha - 2008-??-?? + o Major bugfixes: + - When we switched to using v3 directories, we threw away the part of + the "do we have enough directory info?" calculation that checked + how many relays we believed to still be running based on our own + experience. So if we went offline, we never gave up trying to make + new circuits; worse, when we came back online we didn't recognize + that we should give all the relays another chance. Bugfix on + 0.2.0.9-alpha; fixes bugs 648 and 675. + o Minor bugfixes: - Stop giving double-close warn when we reject an address for client DNS. - On Windows, correctly detect errors when listing the contents of a diff --git a/src/or/routerlist.c b/src/or/routerlist.c index dba976bdc..b82f473c1 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -4189,10 +4189,11 @@ get_dir_info_status_string(void) static void update_router_have_minimum_dir_info(void) { - int num_present = 0, num_usable=0; + int num_present = 0, num_usable=0, num_running=0; time_t now = time(NULL); int res; or_options_t *options = get_options(); + routerinfo_t *ri; const networkstatus_t *consensus = networkstatus_get_reasonably_live_consensus(now); @@ -4218,9 +4219,13 @@ update_router_have_minimum_dir_info(void) SMARTLIST_FOREACH(consensus->routerstatus_list, routerstatus_t *, rs, { if (client_would_use_router(rs, now, options)) { - ++num_usable; - if (router_get_by_digest(rs->identity_digest)) { - ++num_present; + ++num_usable; /* the consensus says we want it. */ + /* XXX021 shouldn't we look up by descriptor digest? */ + ri = router_get_by_digest(rs->identity_digest); + if (ri) { + ++num_present; /* we have some descriptor for it. */ + if (ri->is_running) + ++num_running; /* our local status says it's still up. */ } } }); @@ -4229,10 +4234,10 @@ update_router_have_minimum_dir_info(void) tor_snprintf(dir_info_status, sizeof(dir_info_status), "We have only %d/%d usable descriptors.", num_present, num_usable); res = 0; - } else if (num_present < 2) { + } else if (num_running < 2) { tor_snprintf(dir_info_status, sizeof(dir_info_status), - "Only %d usable descriptor%s known!", num_present, - num_present ? "" : "s"); + "Only %d descriptor%s believed reachable!", num_running, + num_running ? "" : "s"); res = 0; } else { res = 1; @@ -4247,7 +4252,7 @@ update_router_have_minimum_dir_info(void) if (!res && have_min_dir_info) { log(LOG_NOTICE, LD_DIR,"Our directory information is no longer up-to-date " "enough to build circuits.%s", - num_usable > 2 ? "" : " (Not enough servers seem reachable -- " + num_running > 2 ? "" : " (Not enough servers seem reachable -- " "is your network connection down?)"); control_event_client_status(LOG_NOTICE, "NOT_ENOUGH_DIR_INFO"); } |