mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-07 02:39:48 +09:00
Poll the channel in ssh_channel_poll() when the buffer isn't empty
Previously the call to ssh_handle_packets() would be skipped if the buffer wasn't empty. This meant that if ssh_channel_poll() was called on a non-blocking channel with callbacks to handle incoming data, and the buffer already had some data, the callbacks would never be called. Signed-off-by: James Wrigley <james@puiterwijk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Jakub Jelen
parent
c4e547f3f7
commit
6c59d975ba
@@ -3239,6 +3239,8 @@ int ssh_channel_read_nonblocking(ssh_channel channel,
|
||||
/**
|
||||
* @brief Polls a channel for data to read.
|
||||
*
|
||||
* If callbacks are set on the channel, they will be called.
|
||||
*
|
||||
* @param[in] channel The channel to poll.
|
||||
*
|
||||
* @param[in] is_stderr A boolean to select the stderr stream.
|
||||
@@ -3266,7 +3268,7 @@ int ssh_channel_poll(ssh_channel channel, int is_stderr)
|
||||
stdbuf = channel->stderr_buffer;
|
||||
}
|
||||
|
||||
if (ssh_buffer_get_len(stdbuf) == 0 && channel->remote_eof == 0) {
|
||||
if (channel->remote_eof == 0) {
|
||||
if (channel->session->session_state == SSH_SESSION_STATE_ERROR){
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user