tomaswolf opened a new pull request, #292:
URL: https://github.com/apache/mina-sshd/pull/292

   The previous implementation would always reset the window to the maximum 
size when it had dropped to below half the maximum size.
   
   This was wrong and defeated the purpose of having a window. The window size 
is reduced upon reception of the data, and incremented when the reader from the 
channel has read some data. With a slow reader and a fast sender, the window 
would be opened fully even if the reader had not read the previously 
accumulated data. As a result, internal buffers could exceed the window size by 
a lot.
   
   (Consider the very good description in ChannelDataReceiver: if the exit toll 
booth always tells the entry the bridge was free again, far too many cars would 
be let onto the bridge. With a real bridge, there'd be a gigantic traffic jam; 
with Apache MINA sshd, the bridge (the internal buffers) would just get longer 
and longer.)
   
   Change the algorithm to increase the window size only by as much as has 
actually been read by the channel reader. Use the same logic as OpenSSH: send a 
window adjustment message when the available size is smaller than half the full 
window size, or if more than three full SSH packets have been buffered.
   
   To avoid sending a window adjustment for very small amounts, require a 
minimum size for the adjustment (more than half a packet, or more than a tenth 
of the full window, or more than 16kB -- because packet size and full window 
size are configurable, a single minimum value is not good enough.)
   
   If there are multiple threads reading (for instance, one from stdout and one 
from stderr), make sure that normally only one will cause a window adjustment 
to be sent.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to