diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-03-14 15:29:02 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-03-14 15:29:02 -0400 |
commit | b639add1a010d5816ceb693c68ddc3b48655b752 (patch) | |
tree | cb1f817e989e2cb48615bb6352743590a819f2fb /src/or/dirserv.c | |
parent | d34a5cdc597824e72453009ed209e5644f158e90 (diff) | |
parent | 61f648ae3764daacb3865c8344f0381fd09a8e45 (diff) | |
download | tor-b639add1a010d5816ceb693c68ddc3b48655b752.tar.gz tor-b639add1a010d5816ceb693c68ddc3b48655b752.zip |
Merge remote branch 'arma/bug2716' into maint-0.2.2
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r-- | src/or/dirserv.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 40136a18e3..18abd1865f 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -971,8 +971,18 @@ dirserv_set_router_is_running(routerinfo_t *router, time_t now) } if (!answer && running_long_enough_to_decide_unreachable()) { - /* not considered reachable. tell rephist. */ - rep_hist_note_router_unreachable(router->cache_info.identity_digest, now); + /* Not considered reachable. tell rephist about that. + + Because we launch a reachability test for each router every + REACHABILITY_TEST_CYCLE_PERIOD seconds, then the router has probably + been down since at least that time after we last successfully reached + it. + */ + time_t when = now; + if (router->last_reachable && + router->last_reachable + REACHABILITY_TEST_CYCLE_PERIOD < now) + when = router->last_reachable + REACHABILITY_TEST_CYCLE_PERIOD; + rep_hist_note_router_unreachable(router->cache_info.identity_digest, when); } router->is_running = answer; @@ -3204,8 +3214,8 @@ dirserv_single_reachability_test(time_t now, routerinfo_t *router) * try a few connections per call. * * The load balancing is such that if we get called once every ten - * seconds, we will cycle through all the tests in 1280 seconds (a - * bit over 20 minutes). + * seconds, we will cycle through all the tests in + * REACHABILITY_TEST_CYCLE_PERIOD seconds (a bit over 20 minutes). */ void dirserv_test_reachability(time_t now) @@ -3231,11 +3241,11 @@ dirserv_test_reachability(time_t now) continue; /* bridge authorities only test reachability on bridges */ // if (router->cache_info.published_on > cutoff) // continue; - if ((((uint8_t)id_digest[0]) % 128) == ctr) { + if ((((uint8_t)id_digest[0]) % REACHABILITY_MODULO_PER_TEST) == ctr) { dirserv_single_reachability_test(now, router); } } SMARTLIST_FOREACH_END(router); - ctr = (ctr + 1) % 128; /* increment ctr */ + ctr = (ctr + 1) % REACHABILITY_MODULO_PER_TEST; /* increment ctr */ } /** Given a fingerprint <b>fp</b> which is either set if we're looking for a |