Fixed an issue with the libssh2_poll_channel_read function not

reading both normal and extended data when a non-zero value
is passed in as the 2nd parameter. This now matches the functionallity
described in the documentation.
This commit is contained in:
Paul Thomas 2008-10-01 01:31:15 +00:00
parent 8c43bc52b1
commit b228f132f7

View File

@ -1189,14 +1189,15 @@ libssh2_poll_channel_read(LIBSSH2_CHANNEL * channel, int extended)
LIBSSH2_SESSION *session = channel->session; LIBSSH2_SESSION *session = channel->session;
LIBSSH2_PACKET *packet = session->packets.head; LIBSSH2_PACKET *packet = session->packets.head;
while (packet) { while (packet)
if (((packet->data[0] == SSH_MSG_CHANNEL_DATA) && (extended == 0) && {
(channel->local.id == libssh2_ntohu32(packet->data + 1))) || if ( channel->local.id == libssh2_ntohu32(packet->data + 1)) {
((packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA) if ( extended == 1 &&
&& (extended != 0) (packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA || packet->data[0] == SSH_MSG_CHANNEL_DATA ))
&& (channel->local.id == libssh2_ntohu32(packet->data + 1)))) {
/* Found data waiting to be read */
return 1; return 1;
else if ( extended == 0 && packet->data[0] == SSH_MSG_CHANNEL_DATA)
return 1;
//else - no data of any type is ready to be read
} }
packet = packet->next; packet = packet->next;
} }