_libssh2_channel_close: don't call transport read if disconnected
The loop that waits for remote.close to get set may end up looping forever since session->socket_state gets set to LIBSSH2_SOCKET_DISCONNECTED by the packet_add() function called from the transport_read() function and after having been set to LIBSSH2_SOCKET_DISCONNECTED, the transport_read() function will only return 0. Bug: http://trac.libssh2.org/ticket/198
This commit is contained in:
parent
6875285b71
commit
811cce09b5
@ -2304,9 +2304,9 @@ int _libssh2_channel_close(LIBSSH2_CHANNEL * channel)
|
||||
if (channel->close_state == libssh2_NB_state_sent) {
|
||||
/* We must wait for the remote SSH_MSG_CHANNEL_CLOSE message */
|
||||
|
||||
while (!channel->remote.close && !rc) {
|
||||
while (!channel->remote.close && !rc &&
|
||||
(session->socket_state != LIBSSH2_SOCKET_DISCONNECTED))
|
||||
rc = _libssh2_transport_read(session);
|
||||
}
|
||||
}
|
||||
|
||||
if(rc != LIBSSH2_ERROR_EAGAIN) {
|
||||
|
Loading…
Reference in New Issue
Block a user