summaryrefslogtreecommitdiff
path: root/src/feature/nodelist
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-08-24 12:44:46 -0400
committerNick Mathewson <nickm@torproject.org>2018-08-24 12:44:46 -0400
commit622231ce2e3abc033172d5c82df7fb6bfd374db0 (patch)
treefcf35a0912103ed8b51f3c770de5ca067cb76cb5 /src/feature/nodelist
parentb1d0fa04fb8ac321d6c46633635cdf84ba416168 (diff)
parent7a5896d5d444d2e32190063e38abb23030daae06 (diff)
downloadtor-622231ce2e3abc033172d5c82df7fb6bfd374db0.tar.gz
tor-622231ce2e3abc033172d5c82df7fb6bfd374db0.zip
Merge remote-tracking branch 'teor/bug27237'
Diffstat (limited to 'src/feature/nodelist')
-rw-r--r--src/feature/nodelist/nodelist.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/feature/nodelist/nodelist.c b/src/feature/nodelist/nodelist.c
index a0f068cf90..d6bc474483 100644
--- a/src/feature/nodelist/nodelist.c
+++ b/src/feature/nodelist/nodelist.c
@@ -2382,9 +2382,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;
@@ -2400,7 +2405,7 @@ compute_frac_paths_available(const networkstatus_t *consensus,
(int)(f_exit*100),
(router_have_consensus_path() == CONSENSUS_PATH_EXIT ?
"exit bw" :
- "end bw (no exits in consensus)"),
+ "end bw (no exits in consensus, using mid)"),
(int)(f_path*100));
return f_path;