changeset 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 3b624ad2dc5e
children 10f28c95ca31
files common-session.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
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 */