comparison common-session.c @ 373:70caa99bfe3a channel-fix

Tidy up behaviour when select() is interrupted. We follow normal codepaths, just with no FDs set.
author Matt Johnston <matt@ucc.asn.au>
date Tue, 05 Dec 2006 13:27:59 +0000
parents bf29e6659fb9
children a01c0c8e543a
comparison
equal deleted inserted replaced
365:49fcc9875045 373:70caa99bfe3a
141 141
142 if (exitflag) { 142 if (exitflag) {
143 dropbear_exit("Terminated by signal"); 143 dropbear_exit("Terminated by signal");
144 } 144 }
145 145
146 if (val < 0) { 146 if (val < 0 && errno != EINTR) {
147 if (errno == EINTR) { 147 dropbear_exit("Error in select");
148 /* This must happen even if we've been interrupted, so that 148 }
149 * changed signal-handler vars can take effect etc */ 149
150 if (loophandler) { 150 if (val <= 0) {
151 loophandler(); 151 /* If we were interrupted or the select timed out, we still
152 } 152 * want to iterate over channels etc for reading, to handle
153 continue; 153 * server processes exiting etc.
154 } else { 154 * We don't want to read/write FDs. */
155 dropbear_exit("Error in select"); 155 FD_ZERO(&writefd);
156 } 156 FD_ZERO(&readfd);
157 } 157 }
158 158
159 /* check for auth timeout, rekeying required etc */ 159 /* check for auth timeout, rekeying required etc */
160 checktimeouts(); 160 checktimeouts();
161
162 if (val == 0) {
163 /* timeout */
164 TRACE(("select timeout"))
165 continue;
166 }
167 161
168 /* process session socket's incoming/outgoing data */ 162 /* process session socket's incoming/outgoing data */
169 if (ses.sock != -1) { 163 if (ses.sock != -1) {
170 if (FD_ISSET(ses.sock, &writefd) && !isempty(&ses.writequeue)) { 164 if (FD_ISSET(ses.sock, &writefd) && !isempty(&ses.writequeue)) {
171 write_packet(); 165 write_packet();