From 403f99eaa48b0374c9a21f624f81ecae521734b3 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Sun, 22 Nov 2009 07:15:30 -0500 Subject: [PATCH] add a minimum for CircuitStreamTimeout, plus a man page plus some other unrelated touchups that have been sitting in my sandbox --- doc/tor.1.in | 7 +++++++ src/common/log.c | 2 +- src/or/config.c | 23 +++++++++++++++++------ src/or/relay.c | 2 +- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/doc/tor.1.in b/doc/tor.1.in index 1a71026aad..4bcab6d04d 100644 --- a/doc/tor.1.in +++ b/doc/tor.1.in @@ -466,6 +466,13 @@ circuit list. (Default: 1 hour.) .LP .TP +\fBCircuitStreamTimeout \fR\fINUM\fP +If non-zero, this option overrides our internal timeout schedule for +how many seconds until we detach a stream from a circuit and try a new +circuit. If your network is particularly slow, you might want to set +this to a number like 60. (Default: 0) +.LP +.TP \fBClientOnly \fR\fB0\fR|\fB1\fR\fP If set to 1, Tor will under no circumstances run as a server or serve directory requests. The default diff --git a/src/common/log.c b/src/common/log.c index a83f945459..9912080af6 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -81,7 +81,7 @@ should_log_function_name(log_domain_mask_t domain, int severity) /* All debugging messages occur in interesting places. */ return 1; case LOG_NOTICE: - case LOG_WARN: + case LOG_WARN: case LOG_ERR: /* We care about places where bugs occur. */ return (domain == LD_BUG); diff --git a/src/or/config.c b/src/or/config.c index 2d21435248..66f9d0488b 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -2943,6 +2943,10 @@ compute_publishserverdescriptor(or_options_t *options) * will generate too many circuits and potentially overload the network. */ #define MIN_MAX_CIRCUIT_DIRTINESS 10 +/** Lowest allowable value for CircuitStreamTimeout; if this is too low, Tor + * will generate too many circuits and potentially overload the network. */ +#define MIN_CIRCUIT_STREAM_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 @@ -3374,23 +3378,30 @@ options_validate(or_options_t *old_options, or_options_t *options, } if (options->RendPostPeriod < MIN_REND_POST_PERIOD) { - log(LOG_WARN,LD_CONFIG,"RendPostPeriod option is too short; " - "raising to %d seconds.", MIN_REND_POST_PERIOD); + log_warn(LD_CONFIG, "RendPostPeriod option is too short; " + "raising to %d seconds.", MIN_REND_POST_PERIOD); options->RendPostPeriod = MIN_REND_POST_PERIOD; } if (options->RendPostPeriod > MAX_DIR_PERIOD) { - log(LOG_WARN, LD_CONFIG, "RendPostPeriod is too large; clipping to %ds.", - MAX_DIR_PERIOD); + log_warn(LD_CONFIG, "RendPostPeriod is too large; clipping to %ds.", + MAX_DIR_PERIOD); options->RendPostPeriod = MAX_DIR_PERIOD; } if (options->MaxCircuitDirtiness < MIN_MAX_CIRCUIT_DIRTINESS) { - log(LOG_WARN, LD_CONFIG, "MaxCircuitDirtiness option is too short; " - "raising to %d seconds.", MIN_MAX_CIRCUIT_DIRTINESS); + log_warn(LD_CONFIG, "MaxCircuitDirtiness option is too short; " + "raising to %d seconds.", MIN_MAX_CIRCUIT_DIRTINESS); options->MaxCircuitDirtiness = MIN_MAX_CIRCUIT_DIRTINESS; } + if (options->CircuitStreamTimeout && + options->CircuitStreamTimeout < MIN_CIRCUIT_STREAM_TIMEOUT) { + log_warn(LD_CONFIG, "CircuitStreamTimeout option is too short; " + "raising to %d seconds.", MIN_CIRCUIT_STREAM_TIMEOUT); + options->CircuitStreamTimeout = MIN_CIRCUIT_STREAM_TIMEOUT; + } + if (options->KeepalivePeriod < 1) REJECT("KeepalivePeriod option must be positive."); diff --git a/src/or/relay.c b/src/or/relay.c index 2151ddeb9b..00e70d95c1 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -1846,7 +1846,7 @@ set_streams_blocked_on_circ(circuit_t *circ, or_connection_t *orconn, } /** Pull as many cells as possible (but no more than max) from the - * queue of the first active circuit on conn, and write then to + * queue of the first active circuit on conn, and write them to * conn->outbuf. Return the number of cells written. Advance * the active circuit pointer to the next active circuit in the ring. */ int -- 2.11.4.GIT