comparison common-session.c @ 1292:432b0a030fd6

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 9169e4e7cbee
children 750ec4ec4cbe
comparison
equal deleted inserted replaced
1291:4a4e5d823cf6 1292:432b0a030fd6
548 } 548 }
549 549
550 static long select_timeout() { 550 static long select_timeout() {
551 /* determine the minimum timeout that might be required, so 551 /* determine the minimum timeout that might be required, so
552 as to avoid waking when unneccessary */ 552 as to avoid waking when unneccessary */
553 long timeout = LONG_MAX; 553 long timeout = KEX_REKEY_TIMEOUT;
554 long now = monotonic_now(); 554 long now = monotonic_now();
555 555
556 update_timeout(KEX_REKEY_TIMEOUT, now, ses.kexstate.lastkextime, &timeout); 556 if (!ses.kexstate.sentkexinit) {
557 update_timeout(KEX_REKEY_TIMEOUT, now, ses.kexstate.lastkextime, &timeout);
558 }
557 559
558 if (ses.authstate.authdone != 1 && IS_DROPBEAR_SERVER) { 560 if (ses.authstate.authdone != 1 && IS_DROPBEAR_SERVER) {
559 /* AUTH_TIMEOUT is only relevant before authdone */ 561 /* AUTH_TIMEOUT is only relevant before authdone */
560 update_timeout(AUTH_TIMEOUT, now, ses.connect_time, &timeout); 562 update_timeout(AUTH_TIMEOUT, now, ses.connect_time, &timeout);
561 } 563 }