diff common-session.c @ 1310:090033317ca1

Avoid busy loop while waiting for rekey response
author Matt Johnston <matt@ucc.asn.au>
date Fri, 29 Apr 2016 23:04:10 +0800
parents 6a14b1f6dc04
children 2c9dac2d6707
line wrap: on
line diff
--- 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 */