channel_wait_closed: don't fail when unread data is queued
This function was calling channel_wait_eof to ensure that the EOF
packet has already been received, but that function also checks that
the read data queue is empty before reporting the EOF. That caused
channel_wait_closed to fail with a LIBSSH2_ERROR_INVAL when some data
was queued even after a successful call to libssh2_channel_wait_eof.
This patch changes libssh2_channel_wait_closed to look directly into
channel->remote.eof so that both libssh2_channel_wait_eof and
libssh2_channel_wait_closed bahave consistently.
diff --git a/src/channel.c b/src/channel.c
index 76d6e93..96db3a6 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -2396,7 +2396,7 @@
LIBSSH2_SESSION *session = channel->session;
int rc;
- if (!libssh2_channel_eof(channel)) {
+ if (!channel->remote.eof) {
return _libssh2_error(session, LIBSSH2_ERROR_INVAL,
"libssh2_channel_wait_closed() invoked when "
"channel is not in EOF state");