diff options
author | teor <teor@torproject.org> | 2018-08-24 11:59:47 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2018-08-24 12:49:05 +1000 |
commit | 7a5896d5d444d2e32190063e38abb23030daae06 (patch) | |
tree | 6d953f4e8385f145438a0866159f9137e9d77f93 /src/feature/nodelist | |
parent | 677048fe9fd04363f1709aa9df7596d70fe542d6 (diff) | |
download | tor-7a5896d5d444d2e32190063e38abb23030daae06.tar.gz tor-7a5896d5d444d2e32190063e38abb23030daae06.zip |
Bootstrap: try harder to get descriptors in non-exit test networks
Use the mid weight for the third hop when there are no exits.
Fixes bug 27237; bugfix on 0.2.6.2-alpha.
Diffstat (limited to 'src/feature/nodelist')
-rw-r--r-- | src/feature/nodelist/nodelist.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/feature/nodelist/nodelist.c b/src/feature/nodelist/nodelist.c index bf298337ae..07edc5abab 100644 --- a/src/feature/nodelist/nodelist.c +++ b/src/feature/nodelist/nodelist.c @@ -2361,9 +2361,14 @@ compute_frac_paths_available(const networkstatus_t *consensus, f_exit = f_myexit; } - /* if the consensus has no exits, treat the exit fraction as 100% */ + /* if the consensus has no exits, we can only build onion service paths, + * which are G - M - M. So use the middle fraction for the exit fraction. */ if (router_have_consensus_path() != CONSENSUS_PATH_EXIT) { - f_exit = 1.0; + /* If there are no exits in the consensus, then f_exit is always 0, so + * it is safe to replace f_exit with f_mid. */ + if (!BUG(f_exit > 0.0)) { + f_exit = f_mid; + } } f_path = f_guard * f_mid * f_exit; @@ -2379,7 +2384,7 @@ compute_frac_paths_available(const networkstatus_t *consensus, (int)(f_exit*100), (router_have_consensus_path() == CONSENSUS_PATH_EXIT ? "" : - " (no exits in consensus)"), + " (no exits in consensus, using mid)"), (int)(f_path*100)); return f_path; |