From 171456c6832ea7557ead828279f46438f1526626 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Fri, 29 Apr 2016 23:04:10 +0800 Subject: [PATCH] Avoid busy loop while waiting for rekey response --- common-session.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common-session.c b/common-session.c index 0563c6f..9d586c0 100644 --- a/common-session.c +++ b/common-session.c @@ -550,10 +550,12 @@ static void update_timeout(long limit, long now, long last_event, long * timeout static long select_timeout() { /* determine the minimum timeout that might be required, so as to avoid waking when unneccessary */ - long timeout = LONG_MAX; + long timeout = KEX_REKEY_TIMEOUT; long now = monotonic_now(); - update_timeout(KEX_REKEY_TIMEOUT, now, ses.kexstate.lastkextime, &timeout); + if (!ses.kexstate.sentkexinit) { + update_timeout(KEX_REKEY_TIMEOUT, now, ses.kexstate.lastkextime, &timeout); + } if (ses.authstate.authdone != 1 && IS_DROPBEAR_SERVER) { /* AUTH_TIMEOUT is only relevant before authdone */