From d13b996d83cb346cf81f5d9b46486556d98073d1 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sat, 9 Mar 2013 19:45:17 -0500 Subject: Fix to test for bug8444 / 6034 --- src/or/circuitbuild.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/or') diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index f8521c5cff..24362460cd 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -540,6 +540,7 @@ circuit_build_times_get_initial_timeout(void) * Check if we have LearnCircuitBuildTimeout, and if we don't, * always use CircuitBuildTimeout, no questions asked. */ + /*XXXX025 this logic could be cleaned up a lot. */ if (get_options()->LearnCircuitBuildTimeout) { if (!unit_tests && get_options()->CircuitBuildTimeout) { timeout = get_options()->CircuitBuildTimeout*1000; @@ -552,7 +553,10 @@ circuit_build_times_get_initial_timeout(void) timeout = circuit_build_times_initial_timeout(); } } else { - timeout = get_options()->CircuitBuildTimeout*1000; + if (get_options()->CircuitBuildTimeout > 0) + timeout = get_options()->CircuitBuildTimeout*1000; + else + timeout = circuit_build_times_initial_timeout(); } return timeout; -- cgit v1.2.3-54-g00ecf From 7543fb61e34e9235c6c330270d0c370c64c3322a Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 13 Mar 2013 09:11:31 -0400 Subject: Simplify the logic of circuit_build_times_get_initial_timeout. --- src/or/circuitbuild.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'src/or') diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 24362460cd..fb8240b940 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -540,23 +540,16 @@ circuit_build_times_get_initial_timeout(void) * Check if we have LearnCircuitBuildTimeout, and if we don't, * always use CircuitBuildTimeout, no questions asked. */ - /*XXXX025 this logic could be cleaned up a lot. */ - if (get_options()->LearnCircuitBuildTimeout) { - if (!unit_tests && get_options()->CircuitBuildTimeout) { - timeout = get_options()->CircuitBuildTimeout*1000; - if (timeout < circuit_build_times_min_timeout()) { - log_warn(LD_CIRC, "Config CircuitBuildTimeout too low. Setting to %ds", - circuit_build_times_min_timeout()/1000); - timeout = circuit_build_times_min_timeout(); - } - } else { - timeout = circuit_build_times_initial_timeout(); + if (!unit_tests && get_options()->CircuitBuildTimeout) { + timeout = get_options()->CircuitBuildTimeout*1000; + if (get_options()->LearnCircuitBuildTimeout && + timeout < circuit_build_times_min_timeout()) { + log_warn(LD_CIRC, "Config CircuitBuildTimeout too low. Setting to %ds", + circuit_build_times_min_timeout()/1000); + timeout = circuit_build_times_min_timeout(); } } else { - if (get_options()->CircuitBuildTimeout > 0) - timeout = get_options()->CircuitBuildTimeout*1000; - else - timeout = circuit_build_times_initial_timeout(); + timeout = circuit_build_times_initial_timeout(); } return timeout; -- cgit v1.2.3-54-g00ecf From b9a8f8c17ce11dd867e0afec7cbb65c55a3d7e8c Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 13 Mar 2013 09:17:43 -0400 Subject: Fix the warning about LearnCircuitBuildTimeout && !CircuitBuildTimeout This is for bug 6304. Add a changes file too --- changes/bug6304 | 4 ++++ src/or/config.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 changes/bug6304 (limited to 'src/or') diff --git a/changes/bug6304 b/changes/bug6304 new file mode 100644 index 0000000000..445560a8e1 --- /dev/null +++ b/changes/bug6304 @@ -0,0 +1,4 @@ + o Minor bugfixes: + - Behave correctly when the user disables LearnCircuitBuildTimeout + but doesn't tell us what they would like the timeout to be. Fixes + bug 6304; bugfix on 0.2.2.14-alpha. diff --git a/src/or/config.c b/src/or/config.c index 90a5dfbda1..b04a8745f1 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -3761,15 +3761,19 @@ options_validate(or_options_t *old_options, or_options_t *options, options->LearnCircuitBuildTimeout = 0; } - if (!(options->LearnCircuitBuildTimeout) && - options->CircuitBuildTimeout < RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT) { + if (!options->LearnCircuitBuildTimeout && options->CircuitBuildTimeout && + options->CircuitBuildTimeout < RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT) { log_warn(LD_CONFIG, - "CircuitBuildTimeout is shorter (%d seconds) than recommended " - "(%d seconds), and LearnCircuitBuildTimeout is disabled. " + "CircuitBuildTimeout is shorter (%d seconds) than the recommended " + "minimum (%d seconds), and LearnCircuitBuildTimeout is disabled. " "If tor isn't working, raise this value or enable " "LearnCircuitBuildTimeout.", options->CircuitBuildTimeout, RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT ); + } else if (!options->LearnCircuitBuildTimeout && + !options->CircuitBuildTimeout) { + log_notice(LD_CONFIG, "You disabled LearnCircuitBuildTimeout, but didn't " + "a CircuitBuildTimeout. I'll pick a plausible default."); } if (options->MaxCircuitDirtiness < MIN_MAX_CIRCUIT_DIRTINESS) { -- cgit v1.2.3-54-g00ecf