[or-cvs] [tor/master] add a minimum for CircuitStreamTimeout, plus a man page

arma at seul.org arma at seul.org
Sun Nov 22 12:16:23 UTC 2009


Author: Roger Dingledine <arma at torproject.org>
Date: Sun, 22 Nov 2009 07:15:30 -0500
Subject: add a minimum for CircuitStreamTimeout, plus a man page
Commit: 403f99eaa48b0374c9a21f624f81ecae521734b3

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 1a71026..4bcab6d 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 a83f945..9912080 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 2d21435..66f9d04 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 <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
@@ -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 2151dde..00e70d9 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 <b>max</b>) from the
- * queue of the first active circuit on <b>conn</b>, and write then to
+ * queue of the first active circuit on <b>conn</b>, and write them to
  * <b>conn</b>-&gt;outbuf.  Return the number of cells written.  Advance
  * the active circuit pointer to the next active circuit in the ring. */
 int
-- 
1.5.6.5



More information about the tor-commits mailing list