summaryrefslogtreecommitdiffhomepage
path: root/common-session.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2015-08-07 21:02:49 +0800
committerMatt Johnston <matt@ucc.asn.au>2015-08-07 21:02:49 +0800
commit24bae46e429aa54d0b9da29adf06192a799dd520 (patch)
tree0994e7c8a5cd2ba42afb94b78e9f4256cc5cc01a /common-session.c
parent7585d4606e120309053104d6680d359a1c1a3ac8 (diff)
only update keepalive timeout post-auth (when keepalives are sent)
Diffstat (limited to 'common-session.c')
-rw-r--r--common-session.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/common-session.c b/common-session.c
index 4b7e38c..2485cd8 100644
--- a/common-session.c
+++ b/common-session.c
@@ -533,11 +533,11 @@ static void checktimeouts() {
}
static void update_timeout(long limit, long now, long last_event, long * timeout) {
- TRACE(("update_timeout limit %ld, now %ld, last %ld, timeout %ld",
+ TRACE2(("update_timeout limit %ld, now %ld, last %ld, timeout %ld",
limit, now, last_event, *timeout))
if (last_event > 0 && limit > 0) {
*timeout = MIN(*timeout, last_event+limit-now);
- TRACE(("update to %ld", *timeout))
+ TRACE2(("new timeout %ld", *timeout))
}
}
@@ -554,15 +554,15 @@ static long select_timeout() {
update_timeout(AUTH_TIMEOUT, now, ses.connect_time, &timeout);
}
- update_timeout(opts.keepalive_secs, now,
- MAX(ses.last_packet_time_keepalive_recv, ses.last_packet_time_keepalive_sent),
- &timeout);
+ if (ses.authstate.authdone) {
+ update_timeout(opts.keepalive_secs, now,
+ MAX(ses.last_packet_time_keepalive_recv, ses.last_packet_time_keepalive_sent),
+ &timeout);
+ }
update_timeout(opts.idle_timeout_secs, now, ses.last_packet_time_idle,
&timeout);
- TRACE(("timeout %ld", timeout))
-
/* clamp negative timeouts to zero - event has already triggered */
return MAX(timeout, 0);
}