mirror of
				https://github.com/libssh2/libssh2.git
				synced 2025-11-03 22:13:11 +03:00 
			
		
		
		
	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:
		@@ -1189,14 +1189,15 @@ libssh2_poll_channel_read(LIBSSH2_CHANNEL * channel, int extended)
 | 
			
		||||
    LIBSSH2_SESSION *session = channel->session;
 | 
			
		||||
    LIBSSH2_PACKET *packet = session->packets.head;
 | 
			
		||||
 | 
			
		||||
    while (packet) {
 | 
			
		||||
        if (((packet->data[0] == SSH_MSG_CHANNEL_DATA) && (extended == 0) &&
 | 
			
		||||
             (channel->local.id == libssh2_ntohu32(packet->data + 1))) ||
 | 
			
		||||
            ((packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA)
 | 
			
		||||
             && (extended != 0)
 | 
			
		||||
             && (channel->local.id == libssh2_ntohu32(packet->data + 1)))) {
 | 
			
		||||
            /* Found data waiting to be read */
 | 
			
		||||
            return 1;
 | 
			
		||||
    while (packet) 
 | 
			
		||||
	{
 | 
			
		||||
		if ( channel->local.id == libssh2_ntohu32(packet->data + 1)) {
 | 
			
		||||
			if ( extended == 1 &&
 | 
			
		||||
				(packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA || packet->data[0] == SSH_MSG_CHANNEL_DATA ))
 | 
			
		||||
				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;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user