# HG changeset patch # User Matt Johnston # Date 1394854622 -28800 # Node ID 9d40ed1da686d01f1b3443097f21d7f4d8e82819 # Parent 7cd89d4e033534d8899b9746f94b44ec4aaa53c3 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. diff -r 7cd89d4e0335 -r 9d40ed1da686 common-session.c --- a/common-session.c Thu Mar 13 23:50:09 2014 +0800 +++ b/common-session.c Sat Mar 15 11:37:02 2014 +0800 @@ -186,13 +186,7 @@ /* check for auth timeout, rekeying required etc */ checktimeouts(); - /* process session socket's incoming/outgoing data */ - if (ses.sock_out != -1) { - if (FD_ISSET(ses.sock_out, &writefd) && !isempty(&ses.writequeue)) { - write_packet(); - } - } - + /* process session socket's incoming data */ if (ses.sock_in != -1) { if (FD_ISSET(ses.sock_in, &readfd)) { if (!ses.remoteident) { @@ -218,6 +212,14 @@ * during rekeying ) */ channelio(&readfd, &writefd); + /* process session socket's outgoing data */ + if (ses.sock_out != -1) { + if (!isempty(&ses.writequeue)) { + write_packet(); + } + } + + if (loophandler) { loophandler(); }