Avoid busy loop while waiting for rekey response

This commit is contained in:
Matt Johnston 2016-04-29 23:04:10 +08:00
parent a453b06168
commit 8174300429

View File

@ -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 */