changeset 960:9e7b0810a4a2

merge
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 Aug 2014 22:08:16 +0800
parents c4f138dae2fd (diff) f92394f3f332 (current diff)
children a4032b946355
files
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/packet.c	Wed Aug 06 22:04:49 2014 +0800
+++ b/packet.c	Wed Aug 06 22:08:16 2014 +0800
@@ -93,9 +93,12 @@
 		iov[i].iov_base = buf_getptr(writebuf, len);
 		iov[i].iov_len = len;
 	}
+	/* This may return EAGAIN. The main loop sometimes
+	calls write_packet() without bothering to test with select() since
+	it's likely to be necessary */
 	written = writev(ses.sock_out, iov, iov_max_count);
 	if (written < 0) {
-		if (errno == EINTR) {
+		if (errno == EINTR || errno == EAGAIN) {
 			m_free(iov);
 			TRACE2(("leave write_packet: EINTR"))
 			return;
@@ -136,7 +139,7 @@
 	written = write(ses.sock_out, buf_getptr(writebuf, len), len);
 
 	if (written < 0) {
-		if (errno == EINTR) {
+		if (errno == EINTR || errno == EAGAIN) {
 			TRACE2(("leave writepacket: EINTR"))
 			return;
 		} else {
@@ -255,7 +258,7 @@
 		ses.remoteclosed();
 	}
 	if (slen < 0) {
-		if (errno == EINTR) {
+		if (errno == EINTR || errno == EAGAIN) {
 			TRACE2(("leave read_packet_init: EINTR"))
 			return DROPBEAR_FAILURE;
 		}