Mercurial > dropbear
changeset 815:35183e8a7851
Improve EOF handling for half-close. Patch from Catalin Patulea
Fixes the situation
$ ./dbclient [email protected] 'cat; echo foo'
^D
<no output>
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 21 Sep 2013 00:17:22 +0800 |
parents | bcfa7f779531 |
children | 84e4259dae3e |
files | common-channel.c |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/common-channel.c Mon Aug 12 22:41:00 2013 +0800 +++ b/common-channel.c Sat Sep 21 00:17:22 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