summaryrefslogtreecommitdiffhomepage
path: root/common-session.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2014-03-15 11:37:02 +0800
committerMatt Johnston <matt@ucc.asn.au>2014-03-15 11:37:02 +0800
commitdb688e3ec1564e744e8791953a6f8a804d86013d (patch)
tree31e6503f6ffb77d19003edd24951faefd20e87b1 /common-session.c
parente767bbb41f277ebb8f477e5cda5b97a3a52b08a7 (diff)
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.
Diffstat (limited to 'common-session.c')
-rw-r--r--common-session.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/common-session.c b/common-session.c
index 6bcb7fa..e23be66 100644
--- a/common-session.c
+++ b/common-session.c
@@ -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) {
@@ -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();
}