aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorAndrea Shepard <andrea@persephoneslair.org>2012-06-08 23:44:06 -0700
committerAndrea Shepard <andrea@persephoneslair.org>2012-06-08 23:44:06 -0700
commit4fb2a14faeb7505e51780fab2c610504edb2646b (patch)
tree64e3482090123e983243f9e8f555e1011f357615 /src/or
parent8be6058d8f31e578de2ba9783b2ccb5da5ab0d9e (diff)
downloadtor-4fb2a14faeb7505e51780fab2c610504edb2646b.tar
tor-4fb2a14faeb7505e51780fab2c610504edb2646b.tar.gz
Warn if the user has set CircuitBuildTimeout stupidly low and turned off LearnCircuitBuildTimeout
Diffstat (limited to 'src/or')
-rw-r--r--src/or/config.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 090d96c15..93fcc194f 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -3320,6 +3320,13 @@ compute_publishserverdescriptor(or_options_t *options)
* expose more information than we're comfortable with. */
#define MIN_HEARTBEAT_PERIOD (30*60)
+/** Lowest recommended value for CircuitBuildTimeout; if it is set too low
+ * and LearnCircuitBuildTimeout is off, the failure rate for circuit
+ * construction may be very high. In that case, if it is set below this
+ * threshold emit a warning.
+ * */
+#define RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT (10)
+
/** Return 0 if every setting in <b>options</b> is reasonable, and a
* permissible transition from <b>old_options</b>. Else return -1.
* Should have no side effects, except for normalizing the contents of
@@ -3716,6 +3723,15 @@ options_validate(or_options_t *old_options, or_options_t *options,
options->LearnCircuitBuildTimeout = 0;
}
+ if (!(options->LearnCircuitBuildTimeout) &&
+ options->CircuitBuildTimeout < RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT) {
+ log_warn(LD_CONFIG,
+ "CircuitBuildTimeout is shorter (%d seconds) than recommended "
+ "(%d seconds), and LearnCircuitBuildTimeout is disabled.",
+ options->CircuitBuildTimeout,
+ RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT );
+ }
+
if (options->MaxCircuitDirtiness < MIN_MAX_CIRCUIT_DIRTINESS) {
log_warn(LD_CONFIG, "MaxCircuitDirtiness option is too short; "
"raising to %d seconds.", MIN_MAX_CIRCUIT_DIRTINESS);