# HG changeset patch # User Matt Johnston # Date 1461942250 -28800 # Node ID 432b0a030fd63008b006bc126f52e8b3d75edbb5 # Parent 4a4e5d823cf69fc7424d7e506ded5efc945e66de Avoid busy loop while waiting for rekey response diff -r 4a4e5d823cf6 -r 432b0a030fd6 common-session.c --- a/common-session.c Tue Apr 12 21:22:21 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 */