Skip to content

Commit

Permalink
Fix issue jetty#5499
Browse files Browse the repository at this point in the history
this PR let the ByteAccumulator recyclable. after invoke ByteAccumulator.transferTo method
we can invoke ByteAccumulator.recycle method to reuse byte[] via ByteAccumulator.newByteArray method

Signed-off-by: chenby <chen.bao.yi@qq.com>
  • Loading branch information
leonchen83 committed Oct 28, 2020
1 parent 054e18b commit ed43b49
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -209,7 +209,11 @@ protected void decompress(ByteAccumulator accumulator, ByteBuffer buf) throws Da
{
byte[] output = accumulator.newByteArray(DECOMPRESS_BUF_SIZE);
read = inflater.inflate(output);
if (read <= 0)
if (read < 0)
{
break;
}
else if (read == 0)
{
if (LOG.isDebugEnabled())
LOG.debug("Decompress: read 0 {}", toDetail(inflater));
Expand Down

0 comments on commit ed43b49

Please sign in to comment.