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.
This commit is contained in:
teor 2018-08-24 11:59:47 +10:00
parent 677048fe9f
commit 7a5896d5d4
No known key found for this signature in database
GPG Key ID: 10FEAA0E7075672A
2 changed files with 12 additions and 3 deletions

4
changes/bug27237 Normal file
View File

@ -0,0 +1,4 @@
o Minor bugfixes (bootstrap):
- Try harder to get descriptors in non-exit test networks, by
using the mid weight for the third hop when there are no exits.
Fixes bug 27237; bugfix on 0.2.6.2-alpha.

View File

@ -2361,9 +2361,14 @@ compute_frac_paths_available(const networkstatus_t *consensus,
f_exit = f_myexit; 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) { 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; f_path = f_guard * f_mid * f_exit;
@ -2379,7 +2384,7 @@ compute_frac_paths_available(const networkstatus_t *consensus,
(int)(f_exit*100), (int)(f_exit*100),
(router_have_consensus_path() == CONSENSUS_PATH_EXIT ? (router_have_consensus_path() == CONSENSUS_PATH_EXIT ?
"" : "" :
" (no exits in consensus)"), " (no exits in consensus, using mid)"),
(int)(f_path*100)); (int)(f_path*100));
return f_path; return f_path;