mirror of
				https://github.com/libssh2/libssh2.git
				synced 2025-10-30 12:05:34 +03:00 
			
		
		
		
	channel_free: ignore problems with channel_close()
As was pointed out in bug #182, we must not return failure from _libssh2_channel_free() when _libssh2_channel_close() returns an error that isn't EAGAIN. It can effectively cause the function to never go through, like it did now in the case where the socket was actually closed but socket_state still said LIBSSH2_SOCKET_CONNECTED. I consider this fix the right thing as it now also survives other errors, even if making sure socket_state isn't lying is also a good idea.
This commit is contained in:
		| @@ -2387,10 +2387,9 @@ int _libssh2_channel_free(LIBSSH2_CHANNEL *channel) | ||||
|  | ||||
|         if(rc == LIBSSH2_ERROR_EAGAIN) | ||||
|             return rc; | ||||
|         else if (rc < 0) { | ||||
|             channel->free_state = libssh2_NB_state_idle; | ||||
|             return rc; | ||||
|         } | ||||
|  | ||||
|         /* ignore all other errors as they otherwise risk blocking the channel | ||||
|            free from happening */ | ||||
|     } | ||||
|  | ||||
|     channel->free_state = libssh2_NB_state_idle; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user