diff common-channel.c @ 837:fdf51d3f26e1 ecc

merge
author Matt Johnston <matt@ucc.asn.au>
date Sun, 20 Oct 2013 21:07:05 +0800
parents 35183e8a7851
children a1a97e98b0c1
line wrap: on
line diff
--- a/common-channel.c	Sun Oct 20 21:06:18 2013 +0800
+++ b/common-channel.c	Sun Oct 20 21:07:05 2013 +0800
@@ -307,7 +307,9 @@
 		return;
 	}
 
-	if (channel->recv_eof && !write_pending(channel)) {
+	if ((channel->recv_eof && !write_pending(channel))
+		/* have a server "session" and child has exited */
+		|| (channel->type->check_close && close_allowed)) {
 		close_chan_fd(channel, channel->writefd, SHUT_WR);
 	}
 
@@ -336,6 +338,7 @@
 
 	/* And if we can't receive any more data from them either, close up */
 	if (channel->readfd == FD_CLOSED
+			&& channel->writefd == FD_CLOSED
 			&& (ERRFD_IS_WRITE(channel) || channel->errfd == FD_CLOSED)
 			&& !channel->sent_close
 			&& close_allowed