[or-cvs] new config option SocksTimeout: How long do we let a socks ...
arma at seul.org
arma at seul.org
Tue Mar 21 23:27:45 UTC 2006
Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or
Modified Files:
circuituse.c config.c connection_edge.c or.h
Log Message:
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.
Index: circuituse.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuituse.c,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -p -d -r1.119 -r1.120
--- circuituse.c 21 Mar 2006 22:22:48 -0000 1.119
+++ circuituse.c 21 Mar 2006 23:27:43 -0000 1.120
@@ -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(c
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),
Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.540
retrieving revision 1.541
diff -u -p -d -r1.540 -r1.541
--- config.c 21 Mar 2006 23:06:47 -0000 1.540
+++ config.c 21 Mar 2006 23:27:43 -0000 1.541
@@ -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"),
Index: connection_edge.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.390
retrieving revision 1.391
diff -u -p -d -r1.390 -r1.391
--- connection_edge.c 19 Mar 2006 03:55:48 -0000 1.390
+++ connection_edge.c 21 Mar 2006 23:27:43 -0000 1.391
@@ -314,7 +314,7 @@ connection_edge_finished_connecting(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'.",
Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.812
retrieving revision 1.813
diff -u -p -d -r1.812 -r1.813
--- or.h 19 Mar 2006 01:44:53 -0000 1.812
+++ or.h 21 Mar 2006 23:27:43 -0000 1.813
@@ -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? */
More information about the tor-commits
mailing list