mirror of
				https://github.com/libssh2/libssh2.git
				synced 2025-11-03 22:13:11 +03:00 
			
		
		
		
	Markus posted a bug report about a bad 0-return from libssh2_channel_read:
http://libssh2.haxx.se/mail/libssh2-devel-archive-2009-04/0076.shtml And it was indeed a bad loop that terminated too early due to a receveived close packet.
This commit is contained in:
		
							
								
								
									
										8
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								NEWS
									
									
									
									
									
								
							@@ -1,4 +1,12 @@
 | 
			
		||||
 | 
			
		||||
* (Apr 30 2009) Daniel Stenberg:
 | 
			
		||||
 | 
			
		||||
  Markus posted a bug report about a bad 0-return from libssh2_channel_read:
 | 
			
		||||
  http://libssh2.haxx.se/mail/libssh2-devel-archive-2009-04/0076.shtml
 | 
			
		||||
 | 
			
		||||
  And it was indeed a bad loop that terminated too early due to a receveived
 | 
			
		||||
  close packet.
 | 
			
		||||
 | 
			
		||||
* (Apr 14 2009) Daniel Stenberg:
 | 
			
		||||
 | 
			
		||||
  libssh2_poll() and libssh2_poll_channel_read() are now considered and
 | 
			
		||||
 
 | 
			
		||||
@@ -1794,8 +1794,15 @@ static ssize_t channel_read(LIBSSH2_CHANNEL *channel, int stream_id,
 | 
			
		||||
 | 
			
		||||
    channel->read_packet = session->packets.head;
 | 
			
		||||
    while (channel->read_packet &&
 | 
			
		||||
           !channel->remote.close &&
 | 
			
		||||
           (bytes_read < (int) buflen)) {
 | 
			
		||||
        /* previously this loop condition also checked for
 | 
			
		||||
           !channel->remote.close but we cannot let it do this:
 | 
			
		||||
 | 
			
		||||
           We may have a series of packets to read that are still pending even
 | 
			
		||||
           if a close has been received. Acknowledging the close too early
 | 
			
		||||
           makes us flush buffers prematurely and loose data.
 | 
			
		||||
        */
 | 
			
		||||
 | 
			
		||||
        LIBSSH2_PACKET *readpkt = channel->read_packet;
 | 
			
		||||
 | 
			
		||||
        /* In case packet gets destroyed during this iteration */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user