From 02c320916e025eca63d0ae23aa4f610095c7857c Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 29 Jan 2013 11:05:13 -0500 Subject: Parameterize FRAC_USABLE_NEEDED for fraction of circuits Instead of hardcoding the minimum fraction of possible paths to 0.6, we take it from the user, and failing that from the consensus, and failing that we fall back to 0.6. --- src/or/config.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/or/config.c') diff --git a/src/or/config.c b/src/or/config.c index 4349b670b0..e503645468 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -325,6 +325,7 @@ static config_var_t option_vars_[] = { V(PathBiasDropGuards, AUTOBOOL, "0"), V(PathBiasUseCloseCounts, AUTOBOOL, "1"), + V(PathsNeededToBuildCircuits, DOUBLE, "-1"), OBSOLETE("PathlenCoinWeight"), V(PerConnBWBurst, MEMUNIT, "0"), V(PerConnBWRate, MEMUNIT, "0"), @@ -2386,6 +2387,18 @@ options_validate(or_options_t *old_options, or_options_t *options, return -1; } + if (options->PathsNeededToBuildCircuits >= 0.0) { + if (options->PathsNeededToBuildCircuits < 0.25) { + log_warn(LD_CONFIG, "PathsNeededToBuildCircuits is too low. Increasing " + "to 0.25"); + options->PathsNeededToBuildCircuits = 0.25; + } else if (options->PathsNeededToBuildCircuits < 0.95) { + log_warn(LD_CONFIG, "PathsNeededToBuildCircuits is too high. Decreasing " + "to 0.95"); + options->PathsNeededToBuildCircuits = 0.95; + } + } + if (options->MaxClientCircuitsPending <= 0 || options->MaxClientCircuitsPending > MAX_MAX_CLIENT_CIRCUITS_PENDING) { tor_asprintf(msg, -- cgit v1.2.3-54-g00ecf