mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
improve accuracy for when a relay went unreachable
This commit is contained in:
parent
600ad7bf8d
commit
977e396e86
5
changes/bug2716
Normal file
5
changes/bug2716
Normal file
@ -0,0 +1,5 @@
|
||||
o Minor features:
|
||||
- When a relay has failed several reachability tests, be more accurate
|
||||
at recording when it became unreachable, so we can in turn provide
|
||||
more accuracy at assigning Stable, Guard, HSDir, etc flags. Bugfix
|
||||
on 0.2.0.6-alpha. Resolves bug 2716.
|
@ -970,7 +970,11 @@ 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);
|
||||
time_t when = now;
|
||||
if (router->last_reachable &&
|
||||
router->last_reachable + REACHABILITY_TEST_PERIOD < now)
|
||||
when = router->last_reachable + REACHABILITY_TEST_PERIOD;
|
||||
rep_hist_note_router_unreachable(router->cache_info.identity_digest, when);
|
||||
}
|
||||
|
||||
router->is_running = answer;
|
||||
@ -3187,7 +3191,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
|
||||
* seconds, we will cycle through all the tests in
|
||||
* 10*REACHABILITY_MASK_PER_TEST seconds (a
|
||||
* bit over 20 minutes).
|
||||
*/
|
||||
void
|
||||
@ -3214,11 +3219,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
|
||||
|
@ -12,6 +12,14 @@
|
||||
#ifndef _TOR_DIRSERV_H
|
||||
#define _TOR_DIRSERV_H
|
||||
|
||||
/** What fraction (1 over this number) of the relay ID space do we
|
||||
* (as a directory authority) launch connections to at each reachability
|
||||
* test? */
|
||||
#define REACHABILITY_MODULO_PER_TEST 128
|
||||
|
||||
/** How many seconds apart are the reachability tests for a given relay? */
|
||||
#define REACHABILITY_TEST_PERIOD (10*REACHABILITY_MODULO_PER_TEST)
|
||||
|
||||
/** Maximum length of an exit policy summary. */
|
||||
#define MAX_EXITPOLICY_SUMMARY_LEN 1000
|
||||
|
||||
|
@ -962,8 +962,9 @@ run_scheduled_events(time_t now)
|
||||
if (accounting_is_enabled(options))
|
||||
accounting_run_housekeeping(now);
|
||||
|
||||
if (now % 10 == 0 && (authdir_mode_tests_reachability(options)) &&
|
||||
!we_are_hibernating()) {
|
||||
if (now % REACHABILITY_TEST_PERIOD/REACHABILITY_MODULO_PER_TEST == 0 &&
|
||||
(authdir_mode_tests_reachability(options)) &&
|
||||
!we_are_hibernating()) {
|
||||
/* try to determine reachability of the other Tor relays */
|
||||
dirserv_test_reachability(now);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user