Parcourir la source

Merge remote-tracking branch 'origin/maint-0.2.4'

Nick Mathewson il y a 11 ans
Parent
commit
80c987fbb4
3 fichiers modifiés avec 20 ajouts et 15 suppressions
  1. 4 0
      changes/bug6304
  2. 8 11
      src/or/circuitstats.c
  3. 8 4
      src/or/config.c

+ 4 - 0
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. 

+ 8 - 11
src/or/circuitstats.c

@@ -417,19 +417,16 @@ circuit_build_times_get_initial_timeout(void)
    * 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();
+  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 {
-    timeout = get_options()->CircuitBuildTimeout*1000;
+    timeout = circuit_build_times_initial_timeout();
   }
 
   return timeout;

+ 8 - 4
src/or/config.c

@@ -2724,15 +2724,19 @@ options_validate(or_options_t *old_options, or_options_t *options,
              "http://freehaven.net/anonbib/#hs-attack06 for details.");
   }
 
-  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->PathBiasNoticeRate > 1.0) {