mirror of
				https://github.com/libssh2/libssh2.git
				synced 2025-11-03 22:13:11 +03:00 
			
		
		
		
	_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:
		@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user