diff options
author | Matt Johnston <matt@ucc.asn.au> | 2006-12-05 13:27:59 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2006-12-05 13:27:59 +0000 |
commit | dd06653e53c9a6a3734eaf5ce5e9374f559a2bf4 (patch) | |
tree | 36957e728f3057f324f4d678f96077a3cbd8e6af /common-session.c | |
parent | 5b8a26f1d1871726d45dadd12d0080d5fb7b50f6 (diff) |
Tidy up behaviour when select() is interrupted. We follow normal
codepaths, just with no FDs set.
--HG--
branch : channel-fix
extra : convert_revision : d348546b80847bc0d42a7b5208bb31a54f1fdfaf
Diffstat (limited to 'common-session.c')
-rw-r--r-- | common-session.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/common-session.c b/common-session.c index b8ea6f7..a16d1f9 100644 --- a/common-session.c +++ b/common-session.c @@ -143,27 +143,21 @@ void session_loop(void(*loophandler)()) { dropbear_exit("Terminated by signal"); } - if (val < 0) { - if (errno == EINTR) { - /* This must happen even if we've been interrupted, so that - * changed signal-handler vars can take effect etc */ - if (loophandler) { - loophandler(); - } - continue; - } else { - dropbear_exit("Error in select"); - } + if (val < 0 && errno != EINTR) { + dropbear_exit("Error in select"); + } + + if (val <= 0) { + /* If we were interrupted or the select timed out, we still + * want to iterate over channels etc for reading, to handle + * server processes exiting etc. + * We don't want to read/write FDs. */ + FD_ZERO(&writefd); + FD_ZERO(&readfd); } /* check for auth timeout, rekeying required etc */ checktimeouts(); - - if (val == 0) { - /* timeout */ - TRACE(("select timeout")) - continue; - } /* process session socket's incoming/outgoing data */ if (ses.sock != -1) { |