Explorar o código

add a minimum for CircuitStreamTimeout, plus a man page

plus some other unrelated touchups that have been sitting in my
sandbox
Roger Dingledine %!s(int64=14) %!d(string=hai) anos
pai
achega
403f99eaa4
Modificáronse 4 ficheiros con 26 adicións e 8 borrados
  1. 7 0
      doc/tor.1.in
  2. 1 1
      src/common/log.c
  3. 17 6
      src/or/config.c
  4. 1 1
      src/or/relay.c

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

+ 1 - 1
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);

+ 17 - 6
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.");
 

+ 1 - 1
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