diff 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
line wrap: on
line diff
--- 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();
 		}