comparison common-session.c @ 402:173a5f89666c channel-fix

propagate from branch 'au.asn.ucc.matt.dropbear' (head b1dd3b94e60a07a176dba2b035ac79968595990a) to branch 'au.asn.ucc.matt.dropbear.channel-fix' (head fc77c3dea87a7c0f374e738d055f0b455495cbc3)
author Matt Johnston <matt@ucc.asn.au>
date Sat, 03 Feb 2007 08:22:58 +0000
parents 70caa99bfe3a
children a01c0c8e543a
comparison
equal deleted inserted replaced
399:a707e6148060 402:173a5f89666c
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();