diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-04-09 11:13:37 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-06-11 11:27:04 -0400 |
commit | 463f6628d316cecdd612b4a78cd5349ab4a824c5 (patch) | |
tree | 427a4293b3cef5fdd75bef8a7f06389ab0ce7ceb /src/or/main.c | |
parent | 24e0b1088acd94ceae3109107fa354b89309e2b7 (diff) | |
download | tor-463f6628d316cecdd612b4a78cd5349ab4a824c5.tar.gz tor-463f6628d316cecdd612b4a78cd5349ab4a824c5.zip |
Give each or_connection_t a slightly randomized idle_timeout
Instead of killing an or_connection_t that has had no circuits for
the last 3 minutes, give every or_connection_t a randomized timeout,
so that an observer can't so easily infer from the connection close
time the time at which its last circuit closed.
Also, increase the base timeout for canonical connections from 3
minutes to 15 minutes.
Fix for ticket 6799.
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/or/main.c b/src/or/main.c index bd23141b97..8a653ca40b 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -993,15 +993,6 @@ directory_info_has_arrived(time_t now, int from_cache) consider_testing_reachability(1, 1); } -/** How long do we wait before killing OR connections with no circuits? - * In Tor versions up to 0.2.1.25 and 0.2.2.12-alpha, we waited 15 minutes - * before cancelling these connections, which caused fast relays to accrue - * many many idle connections. Hopefully 3 minutes is low enough that - * it kills most idle connections, without being so low that we cause - * clients to bounce on and off. - */ -#define IDLE_OR_CONN_TIMEOUT 180 - /** Perform regular maintenance tasks for a single connection. This * function gets run once per second per connection by run_scheduled_events. */ @@ -1088,7 +1079,7 @@ run_connection_housekeeping(int i, time_t now) connection_or_close_normally(TO_OR_CONN(conn), 1); } else if (!connection_or_get_num_circuits(or_conn) && now >= or_conn->timestamp_last_added_nonpadding + - IDLE_OR_CONN_TIMEOUT) { + or_conn->idle_timeout) { log_info(LD_OR,"Expiring non-used OR connection to fd %d (%s:%d) " "[idle %d].", (int)conn->s,conn->address, conn->port, (int)(now - or_conn->timestamp_last_added_nonpadding)); |