diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-03-13 09:11:31 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-03-13 09:11:31 -0400 |
commit | 7543fb61e34e9235c6c330270d0c370c64c3322a (patch) | |
tree | 6d87e6ad0cd43746dbabea89acd104ce2b147694 /src | |
parent | d13b996d83cb346cf81f5d9b46486556d98073d1 (diff) | |
download | tor-7543fb61e34e9235c6c330270d0c370c64c3322a.tar tor-7543fb61e34e9235c6c330270d0c370c64c3322a.tar.gz |
Simplify the logic of circuit_build_times_get_initial_timeout.
Diffstat (limited to 'src')
-rw-r--r-- | src/or/circuitbuild.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 24362460c..fb8240b94 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; |