summaryrefslogtreecommitdiff
path: root/src/or/circuituse.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-01-15 09:09:03 +0000
committerRoger Dingledine <arma@torproject.org>2007-01-15 09:09:03 +0000
commit37b5132ad8cf864c4737db8b7e23c27c77e5bfec (patch)
treecb0699011de170d481231037a5e414c799c9cdf3 /src/or/circuituse.c
parenta9c250837e86eecf503c79ab139c805301320667 (diff)
downloadtor-37b5132ad8cf864c4737db8b7e23c27c77e5bfec.tar.gz
tor-37b5132ad8cf864c4737db8b7e23c27c77e5bfec.zip
Expire socks connections if they spend too long waiting for the
handshake to finish. Previously we would let them sit around for days, if the connecting application didn't close them either. Also take this opportunity to refactor a duplicate bit of circuituse.c. And change the semantics of SocksTimeout slightly, but I think it'll be ok. svn:r9350
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r--src/or/circuituse.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 7c2178fd71..4114d12959 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -532,7 +532,7 @@ circuit_detach_stream(circuit_t *circ, edge_connection_t *conn)
}
/** Find each circuit that has been unused for too long, or dirty
- * for too long and has no streax=ms on it: mark it for close.
+ * for too long and has no streams on it: mark it for close.
*/
static void
circuit_expire_old_circuits(time_t now)
@@ -1180,21 +1180,12 @@ connection_ap_handshake_attach_circuit(edge_connection_t *conn)
{
int retval;
int conn_age;
- int severity;
tor_assert(conn);
tor_assert(conn->_base.state == AP_CONN_STATE_CIRCUIT_WAIT);
tor_assert(conn->socks_request);
conn_age = time(NULL) - conn->_base.timestamp_created;
- severity = (!conn->_base.addr && !conn->_base.port) ? LOG_INFO : LOG_NOTICE;
- if (conn_age > get_options()->SocksTimeout) {
- log_fn(severity, LD_APP,
- "Tried for %d seconds to get a connection to %s:%d. Giving up.",
- conn_age, safe_str(conn->socks_request->address),
- conn->socks_request->port);
- return -1;
- }
if (!connection_edge_is_rendezvous_stream(conn)) { /* we're a general conn */
origin_circuit_t *circ=NULL;