summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-03-21 23:27:43 +0000
committerRoger Dingledine <arma@torproject.org>2006-03-21 23:27:43 +0000
commit28fafb9022930e29658093c0670f670037ae28b6 (patch)
tree7c4d62b918001de817e82f0bbf3bf2115b03e7fa
parent5399e394a83907fb2e4f06ea6c37cbb9a8f9cb45 (diff)
downloadtor-28fafb9022930e29658093c0670f670037ae28b6.tar.gz
tor-28fafb9022930e29658093c0670f670037ae28b6.zip
new config option SocksTimeout: How long do we let a socks connection
wait unattached before we fail it? Use this value for controller socks timeout, for normal socks timeout, and for hidden-service socks timeout. svn:r6217
-rw-r--r--src/or/circuituse.c5
-rw-r--r--src/or/config.c1
-rw-r--r--src/or/connection_edge.c6
-rw-r--r--src/or/or.h2
4 files changed, 7 insertions, 7 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index e808a31825..e8acffa40f 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -13,9 +13,6 @@ const char circuituse_c_id[] =
#include "or.h"
-/** Longest time to wait for a circuit before closing an AP connection */
-#define CONN_AP_MAX_ATTACH_DELAY 59
-
/********* START VARIABLES **********/
extern circuit_t *global_circuitlist; /* from circuitlist.c */
@@ -1154,7 +1151,7 @@ connection_ap_handshake_attach_circuit(connection_t *conn)
tor_assert(conn->socks_request);
conn_age = time(NULL) - conn->timestamp_created;
- if (conn_age > CONN_AP_MAX_ATTACH_DELAY) {
+ if (conn_age > get_options()->SocksTimeout) {
log_notice(LD_APP,
"Tried for %d seconds to get a connection to %s:%d. Giving up.",
conn_age, safe_str(conn->socks_request->address),
diff --git a/src/or/config.c b/src/or/config.c
index b7aacec2d8..1dadbb606b 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -223,6 +223,7 @@ static config_var_t _option_vars[] = {
VAR("SocksListenAddress", LINELIST, SocksListenAddress, NULL),
VAR("SocksPolicy", LINELIST, SocksPolicy, NULL),
VAR("SocksPort", UINT, SocksPort, "9050"),
+ VAR("SocksTimeout", INTERVAL, SocksTimeout, "2 minutes"),
/* if StatusFetchPeriod is 0, see get_status_fetch_period() in main.c */
VAR("StatusFetchPeriod", INTERVAL, StatusFetchPeriod, "0 seconds"),
VAR("StrictEntryNodes", BOOL, StrictEntryNodes, "0"),
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index e07cb4305b..bb19b130ad 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -314,7 +314,7 @@ connection_edge_finished_connecting(connection_t *conn)
* connection_ap_handshake_attach_circuit() to attach to a new circuit (if
* available) or launch a new one.
*
- * For rendezvous streams, simply give up after 45 seconds (with no
+ * For rendezvous streams, simply give up after SocksTimeout seconds (with no
* retry attempt).
*/
void
@@ -335,7 +335,7 @@ connection_ap_expire_beginning(void)
if (conn->type != CONN_TYPE_AP)
continue;
if (conn->state == AP_CONN_STATE_CONTROLLER_WAIT) {
- if (now - conn->timestamp_lastread >= 120) {
+ if (now - conn->timestamp_lastread >= options->SocksTimeout) {
log_notice(LD_APP, "Closing unattached stream.");
connection_mark_unattached_ap(conn, END_STREAM_REASON_TIMEOUT);
}
@@ -355,7 +355,7 @@ connection_ap_expire_beginning(void)
continue;
}
if (circ->purpose == CIRCUIT_PURPOSE_C_REND_JOINED) {
- if (now - conn->timestamp_lastread > 45) {
+ if (now - conn->timestamp_lastread > options->SocksTimeout) {
log_notice(LD_REND,
"Rend stream is %d seconds late. Giving up on address"
" '%s.onion'.",
diff --git a/src/or/or.h b/src/or/or.h
index 634e5ca3b2..c1c4fccdde 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1315,6 +1315,8 @@ typedef struct {
int StatusFetchPeriod; /**< How often do we fetch running-routers lists? */
int KeepalivePeriod; /**< How often do we send padding cells to keep
* connections alive? */
+ int SocksTimeout; /**< How long do we let a socks connection wait
+ * unattached before we fail it? */
int MaxOnionsPending; /**< How many circuit CREATE requests do we allow
* to wait simultaneously before we start dropping
* them? */