comparison common-session.c @ 929:9d40ed1da686

Experiment of always writing data if available. Might waste a writev() with EAGAIN but always saves a select() - needs testing with bandwidth-limited and CPU-limited situations.
author Matt Johnston <matt@ucc.asn.au>
date Sat, 15 Mar 2014 11:37:02 +0800
parents 7cd89d4e0335
children a0819ecfee0b
comparison
equal deleted inserted replaced
928:7cd89d4e0335 929:9d40ed1da686
184 } 184 }
185 185
186 /* check for auth timeout, rekeying required etc */ 186 /* check for auth timeout, rekeying required etc */
187 checktimeouts(); 187 checktimeouts();
188 188
189 /* process session socket's incoming/outgoing data */ 189 /* process session socket's incoming data */
190 if (ses.sock_out != -1) {
191 if (FD_ISSET(ses.sock_out, &writefd) && !isempty(&ses.writequeue)) {
192 write_packet();
193 }
194 }
195
196 if (ses.sock_in != -1) { 190 if (ses.sock_in != -1) {
197 if (FD_ISSET(ses.sock_in, &readfd)) { 191 if (FD_ISSET(ses.sock_in, &readfd)) {
198 if (!ses.remoteident) { 192 if (!ses.remoteident) {
199 /* blocking read of the version string */ 193 /* blocking read of the version string */
200 read_session_identification(); 194 read_session_identification();
215 maybe_flush_reply_queue(); 209 maybe_flush_reply_queue();
216 210
217 /* process pipes etc for the channels, ses.dataallowed == 0 211 /* process pipes etc for the channels, ses.dataallowed == 0
218 * during rekeying ) */ 212 * during rekeying ) */
219 channelio(&readfd, &writefd); 213 channelio(&readfd, &writefd);
214
215 /* process session socket's outgoing data */
216 if (ses.sock_out != -1) {
217 if (!isempty(&ses.writequeue)) {
218 write_packet();
219 }
220 }
221
220 222
221 if (loophandler) { 223 if (loophandler) {
222 loophandler(); 224 loophandler();
223 } 225 }
224 226