From 4fb2a14faeb7505e51780fab2c610504edb2646b Mon Sep 17 00:00:00 2001 From: Andrea Shepard Date: Fri, 8 Jun 2012 23:44:06 -0700 Subject: Warn if the user has set CircuitBuildTimeout stupidly low and turned off LearnCircuitBuildTimeout --- src/or/config.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/or/config.c') diff --git a/src/or/config.c b/src/or/config.c index 090d96c155..93fcc194f1 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 options is reasonable, and a * permissible transition from old_options. 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); -- cgit v1.2.3-54-g00ecf From 6b73fad7096f4d12f5203b0c11d0e8f9417667b9 Mon Sep 17 00:00:00 2001 From: Andrea Shepard Date: Mon, 11 Jun 2012 11:09:19 -0700 Subject: Make RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT warning tell the user how to fix it. --- src/or/config.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/or/config.c') diff --git a/src/or/config.c b/src/or/config.c index 93fcc194f1..2b14772a62 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -3727,7 +3727,9 @@ options_validate(or_options_t *old_options, or_options_t *options, options->CircuitBuildTimeout < RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT) { log_warn(LD_CONFIG, "CircuitBuildTimeout is shorter (%d seconds) than recommended " - "(%d seconds), and LearnCircuitBuildTimeout is disabled.", + "(%d seconds), and LearnCircuitBuildTimeout is disabled. " + "If tor isn't working, raise this value or enable " + "LearnCircuitBuildTimeout.", options->CircuitBuildTimeout, RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT ); } -- cgit v1.2.3-54-g00ecf