[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Unconditionally use config CircuitBuildTimeout if LearnCircuitBuildTimeout is disabled



commit 7df26de948d478bd9d1d85ffb54ca81f9f7488f1
Author: Andrea Shepard <andrea@xxxxxxxxxxxxxxxxxxx>
Date:   Tue Jun 12 12:11:32 2012 -0700

    Unconditionally use config CircuitBuildTimeout if LearnCircuitBuildTimeout is disabled
---
 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 2b5cb21..61576d1 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;
 }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits