Mercurial > dropbear
comparison 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 |
comparison
equal
deleted
inserted
replaced
1309:3b624ad2dc5e | 1310:090033317ca1 |
---|---|
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 } |