1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-02 10:53:16 +03:00

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.
This commit is contained in:
Salvador Fandino
2016-05-09 13:20:40 +02:00
committed by Alexander Lamaison
parent 56dffb0262
commit d013a6b070

View File

@@ -2396,7 +2396,7 @@ static int channel_wait_closed(LIBSSH2_CHANNEL *channel)
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");