mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel L├ęcharny <elecha...@gmail.com>
Subject Re: Change in behaviour of CompressionFilter
Date Wed, 20 Mar 2019 15:05:28 GMT

On 20/03/2019 15:30, Jonathan Valliere wrote:
> The offending code is in AbstractPollingIoProcessor.  Are you agreeing that
> AbstractPollingIoProcessor has no place modifying the buffer positions?
> Removing buf.reset() would probably fix the problem.

The reason we reset the buffer is that we need to send it back to the 
IoHandler in the messageSent event, and to make it readable from its 
starting point.

If the app is sending a message containg "hello world", this string will 
be put into a IoBuffer, which will be read when the data will get sent 
to the remote peer, and the position will then change. The messageSent 
event will send this IoBuffer back to the IoHandler, which will then be 
incapable of telling the app the message "hello world" has been sent, 
because the buffer has been exhausted by the peer write...

This is the reason why we reset the buffer *after* it has been fully sent.

View raw message