diff options
author | Damien Miller <djm@mindrot.org> | 2012-04-22 11:21:10 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2012-04-22 11:21:10 +1000 |
commit | a6508753db3c49910068d8fc324bd284d72ff153 (patch) | |
tree | de5d49ef31b5ba61e9086316baf0bd2afb78fd1b /clientloop.c | |
parent | c6081482b2b72caccce938c100c1b55f7b5e30fe (diff) |
- djm@cvs.openbsd.org 2012/04/11 13:16:19
[channels.c channels.h clientloop.c serverloop.c]
don't spin in accept() when out of fds (ENFILE/ENFILE) - back off for a
while; ok deraadt@ markus@
Diffstat (limited to 'clientloop.c')
-rw-r--r-- | clientloop.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clientloop.c b/clientloop.c index f69a9b025..58357cf39 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.c,v 1.238 2012/01/18 21:46:43 dtucker Exp $ */ | 1 | /* $OpenBSD: clientloop.c,v 1.239 2012/04/11 13:16:19 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -583,10 +583,12 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, | |||
583 | { | 583 | { |
584 | struct timeval tv, *tvp; | 584 | struct timeval tv, *tvp; |
585 | int timeout_secs; | 585 | int timeout_secs; |
586 | time_t minwait_secs; | ||
586 | int ret; | 587 | int ret; |
587 | 588 | ||
588 | /* Add any selections by the channel mechanism. */ | 589 | /* Add any selections by the channel mechanism. */ |
589 | channel_prepare_select(readsetp, writesetp, maxfdp, nallocp, rekeying); | 590 | channel_prepare_select(readsetp, writesetp, maxfdp, nallocp, |
591 | &minwait_secs, rekeying); | ||
590 | 592 | ||
591 | if (!compat20) { | 593 | if (!compat20) { |
592 | /* Read from the connection, unless our buffers are full. */ | 594 | /* Read from the connection, unless our buffers are full. */ |
@@ -639,6 +641,8 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, | |||
639 | if (timeout_secs < 0) | 641 | if (timeout_secs < 0) |
640 | timeout_secs = 0; | 642 | timeout_secs = 0; |
641 | } | 643 | } |
644 | if (minwait_secs != 0) | ||
645 | timeout_secs = MIN(timeout_secs, (int)minwait_secs); | ||
642 | if (timeout_secs == INT_MAX) | 646 | if (timeout_secs == INT_MAX) |
643 | tvp = NULL; | 647 | tvp = NULL; |
644 | else { | 648 | else { |