1
1

Send and receive channel EOF before sending SSH_MSG_CHANNEL_CLOSE

Sending SSH_MSG_CHANNEL_CLOSE without channel EOF is explicitly allowed
in RFC 4254, but some non-conforming servers will hang or time out when
the channel is closed before EOF.

Other common clients send and receive EOF before closing, there are no
drawbacks, and some servers need it to work correctly.
Этот коммит содержится в:
Peter Stuge 2010-02-25 18:38:32 +01:00
родитель a2157c8391
Коммит 16af813b81

Просмотреть файл

@ -2245,6 +2245,14 @@ channel_close(LIBSSH2_CHANNEL * channel)
return 0;
}
if (!channel->local.eof)
if (retcode = channel_send_eof(channel))
return retcode;
if (!channel->remote.eof)
if (retcode = channel_wait_eof(channel))
return retcode;
if (channel->close_state == libssh2_NB_state_idle) {
_libssh2_debug(session, LIBSSH2_TRACE_CONN, "Closing channel %lu/%lu",
channel->local.id, channel->remote.id);