aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-10-26 22:50:40 +0000
committerNick Mathewson <nickm@torproject.org>2007-10-26 22:50:40 +0000
commit2c1d7cf674b3d8b4ec3ca35df69901c82723032e (patch)
tree36c6ff51a51b8be6cf8a1d513b135bce35e4406e /src/or
parentc9c9f581f6e1e60351fe9a26f5720c7e3bda1490 (diff)
downloadtor-2c1d7cf674b3d8b4ec3ca35df69901c82723032e.tar
tor-2c1d7cf674b3d8b4ec3ca35df69901c82723032e.tar.gz
r16194@catbus: nickm | 2007-10-26 18:37:02 -0400
Keep circuitless TLS connections open for 1.5 x MaxCircuitDirtiness: this ensures that we don't thrash closing and repoening connections to our guards. svn:r12218
Diffstat (limited to 'src/or')
-rw-r--r--src/or/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 3c0b4ae43..08b5e805e 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -764,19 +764,23 @@ run_connection_housekeeping(int i, time_t now)
the connection or send a keepalive, depending. */
if (now >= conn->timestamp_lastwritten + options->KeepalivePeriod) {
routerinfo_t *router = router_get_by_digest(or_conn->identity_digest);
+ int maxCircuitlessPeriod = options->MaxCircuitDirtiness*3/2;
if (!connection_state_is_open(conn)) {
+ /* We never managed to actually get this connection open and happy. */
log_info(LD_OR,"Expiring non-open OR connection to fd %d (%s:%d).",
conn->s,conn->address, conn->port);
connection_mark_for_close(conn);
conn->hold_open_until_flushed = 1;
} else if (we_are_hibernating() && !or_conn->n_circuits &&
!buf_datalen(conn->outbuf)) {
+ /* We're hibernating, there's no circuits, and nothing to flush.*/
log_info(LD_OR,"Expiring non-used OR connection to fd %d (%s:%d) "
"[Hibernating or exiting].",
conn->s,conn->address, conn->port);
connection_mark_for_close(conn);
conn->hold_open_until_flushed = 1;
} else if (!clique_mode(options) && !or_conn->n_circuits &&
+ now >= conn->timestamp_lastwritten + maxCircuitlessPeriod &&
(!router || !server_mode(options) ||
!router_is_clique_mode(router))) {
log_info(LD_OR,"Expiring non-used OR connection to fd %d (%s:%d) "