# HG changeset patch # User Matt Johnston # Date 1461942250 -28800 # Node ID 090033317ca14e360594788b6f1b2fff773885d2 # Parent 3b624ad2dc5e051b99e121427238136569a5c9aa Avoid busy loop while waiting for rekey response diff -r 3b624ad2dc5e -r 090033317ca1 common-session.c --- a/common-session.c Sun Jun 19 20:38:38 2016 +0800 +++ b/common-session.c Fri Apr 29 23:04:10 2016 +0800 @@ -550,10 +550,12 @@ 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 */