summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2009-11-21 23:36:36 -0500
committerRoger Dingledine <arma@torproject.org>2009-11-21 23:36:36 -0500
commit7f3f88bed38758d1f6f72cd0864cf93809bb5440 (patch)
treefd6bf8245a58c4112ad1a81715d064bd5b3f35a3 /src/or
parentfdd58f3bd5daa4a8982244d0b956fcfebfd91b6d (diff)
downloadtor-7f3f88bed38758d1f6f72cd0864cf93809bb5440.tar.gz
tor-7f3f88bed38758d1f6f72cd0864cf93809bb5440.zip
New config option "CircuitStreamTimeout"
New config option "CircuitStreamTimeout" to override 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.
Diffstat (limited to 'src/or')
-rw-r--r--src/or/config.c1
-rw-r--r--src/or/connection_edge.c5
-rw-r--r--src/or/or.h9
3 files changed, 12 insertions, 3 deletions
diff --git a/src/or/config.c b/src/or/config.c
index b6a52a85de..2d21435248 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -166,6 +166,7 @@ static config_var_t _option_vars[] = {
V(CellStatistics, BOOL, "0"),
V(CircuitBuildTimeout, INTERVAL, "0"),
V(CircuitIdleTimeout, INTERVAL, "1 hour"),
+ V(CircuitStreamTimeout, INTERVAL, "0"),
V(ClientDNSRejectInternalAddresses, BOOL,"1"),
V(ClientOnly, BOOL, "0"),
V(ConsensusParams, STRING, NULL),
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 97d6595e97..75a57fedd5 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -377,13 +377,16 @@ connection_edge_finished_connecting(edge_connection_t *edge_conn)
static int
compute_retry_timeout(edge_connection_t *conn)
{
+ int timeout = get_options()->CircuitStreamTimeout;
+ if (timeout) /* if our config options override the default, use them */
+ return timeout;
if (conn->num_socks_retries < 2) /* try 0 and try 1 */
return 10;
return 15;
}
/** Find all general-purpose AP streams waiting for a response that sent their
- * begin/resolve cell >=15 seconds ago. Detach from their current circuit, and
+ * begin/resolve cell too long ago. Detach from their current circuit, and
* mark their current circuit as unsuitable for new streams. Then call
* connection_ap_handshake_attach_circuit() to attach to a new circuit (if
* available) or launch a new one.
diff --git a/src/or/or.h b/src/or/or.h
index 767ad95720..2e575f5ef9 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2445,10 +2445,15 @@ typedef struct {
* connections alive? */
int SocksTimeout; /**< How long do we let a socks connection wait
* unattached before we fail it? */
- int CircuitBuildTimeout; /**< Cull non-open circuits that were born
- * at least this many seconds ago. */
+ int CircuitBuildTimeout; /**< If non-zero, cull non-open circuits that
+ * were born at least this many seconds ago. If
+ * zero, use the internal adaptive algorithm. */
int CircuitIdleTimeout; /**< Cull open clean circuits that were born
* at least this many seconds ago. */
+ int CircuitStreamTimeout; /**< If non-zero, detach streams from circuits
+ * and try a new circuit if the stream has been
+ * waiting for this many seconds. If zero, use
+ * our default internal timeout schedule. */
int MaxOnionsPending; /**< How many circuit CREATE requests do we allow
* to wait simultaneously before we start dropping
* them? */