diff options
author | Andrea Shepard <andrea@persephoneslair.org> | 2012-06-12 12:11:32 -0700 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-06-13 16:44:33 -0400 |
commit | 7df26de948d478bd9d1d85ffb54ca81f9f7488f1 (patch) | |
tree | 5563bbae3331232ca75d215d756e095418ca4d51 /src/or | |
parent | 5177ab9e4783c1ca9928ac70d19b7daaeacd6b93 (diff) | |
download | tor-7df26de948d478bd9d1d85ffb54ca81f9f7488f1.tar.gz tor-7df26de948d478bd9d1d85ffb54ca81f9f7488f1.zip |
Unconditionally use config CircuitBuildTimeout if LearnCircuitBuildTimeout is disabled
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/circuitbuild.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 2b5cb21486..61576d12dd 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -535,16 +535,27 @@ static double circuit_build_times_get_initial_timeout(void) { double timeout; - 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(); + + /* + * Check if we have LearnCircuitBuildTimeout, and if we don't, + * always use CircuitBuildTimeout, no questions asked. + */ + 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(); } - } else { - timeout = circuit_build_times_initial_timeout(); } + else { + timeout = get_options()->CircuitBuildTimeout*1000; + } + return timeout; } |