Skip to content

Commit

Permalink
Experiment of always writing data if available. Might waste a writev(…
Browse files Browse the repository at this point in the history
…) with

EAGAIN but always saves a select() - needs testing with bandwidth-limited
and CPU-limited situations.
  • Loading branch information
mkj committed Mar 15, 2014
1 parent e767bbb commit db688e3
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions common-session.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,7 @@ void session_loop(void(*loophandler)()) {
/* 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) {
Expand All @@ -218,6 +212,14 @@ void session_loop(void(*loophandler)()) {
* 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();
}
Expand Down

0 comments on commit db688e3

Please sign in to comment.