This fix addresses bug# 2141548. Channel reads would fail despite

libssh2_poll() detecting that there was data ready to be read on
the socket. This is seen when small amounts of data are ready to
be read, typically 1-4 chars worth.
This commit is contained in:
Paul Thomas 2008-10-02 02:26:49 +00:00
parent fa620b2a7b
commit 006f233361

View File

@ -1521,13 +1521,14 @@ libssh2_channel_read_ex(LIBSSH2_CHANNEL * channel, int stream_id, char *buf,
channel->read_packet = session->packets.head; channel->read_packet = session->packets.head;
} }
if (rc < 0) { //We didn't read any data from the socket and no packets are waiting to be read
if (rc != PACKET_EAGAIN) { if (rc < 0) && (! channel->read_packet)) {
channel->read_state = libssh2_NB_state_idle; if (rc != PACKET_EAGAIN) {
} channel->read_state = libssh2_NB_state_idle;
/* no packets available */ }
return rc; /* no packets available */
} return rc;
}
while (channel->read_packet while (channel->read_packet
&& (channel->read_bytes_read < (int) buflen)) { && (channel->read_bytes_read < (int) buflen)) {