aboutsummaryrefslogtreecommitdiff
path: root/src/feature/nodelist/nodelist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-03-15 08:59:19 -0400
committerNick Mathewson <nickm@torproject.org>2019-03-15 08:59:19 -0400
commit1547fd99a68cb22410ed0842267fb0a1f1de925f (patch)
treecf395da148a20a415092cc7816a6631db33f80f2 /src/feature/nodelist/nodelist.c
parent560ba98dd7e5e4c4a2e3c06ab80e4cf97d8f6f8d (diff)
parent532f4c9103315bff1de21b3e0eeeee6fcf790647 (diff)
downloadtor-1547fd99a68cb22410ed0842267fb0a1f1de925f.tar.gz
tor-1547fd99a68cb22410ed0842267fb0a1f1de925f.zip
Merge branch 'bug28656_035_squashed' into maint-0.4.0
Diffstat (limited to 'src/feature/nodelist/nodelist.c')
-rw-r--r--src/feature/nodelist/nodelist.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/feature/nodelist/nodelist.c b/src/feature/nodelist/nodelist.c
index 9a27701803..8b02dd9c66 100644
--- a/src/feature/nodelist/nodelist.c
+++ b/src/feature/nodelist/nodelist.c
@@ -2493,12 +2493,18 @@ compute_frac_paths_available(const networkstatus_t *consensus,
f_exit = f_myexit;
}
- /* 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 the consensus has no exits that pass flag, descriptor, and policy
+ * checks, we can only build onion service paths, which are G - M - M. */
if (router_have_consensus_path() != CONSENSUS_PATH_EXIT) {
- /* 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)) {
+ /* If the exit bandwidth weight fraction is not zero, we need to wait for
+ * descriptors for those exits. (The bandwidth weight fraction does not
+ * check for descriptors.)
+ * If the exit bandwidth fraction is zero, there are no exits in the
+ * consensus at all. So it is safe to replace f_exit with f_mid.
+ *
+ * f_exit is non-negative, but some compilers complain about float and ==
+ */
+ if (f_exit <= 0.0) {
f_exit = f_mid;
}
}