mirror of
https://github.com/jetty/jetty.project.git
synced 2025-02-23 16:05:00 +00:00
ByteAccumulator transferTo expects buffer in fill mode.
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
7bcae9968b
commit
6e9572215b
@ -72,6 +72,9 @@ public class ByteAccumulator implements AutoCloseable
|
||||
|
||||
public void transferTo(ByteBuffer buffer)
|
||||
{
|
||||
// For some reason this method expects the buffer in fill mode but returns a buffer in flush mode.
|
||||
BufferUtil.flipToFlush(buffer, 0);
|
||||
|
||||
int availableSpace = BufferUtil.space(buffer);
|
||||
if (availableSpace < length)
|
||||
{
|
||||
|
@ -162,6 +162,7 @@ public abstract class CompressExtension extends AbstractExtension
|
||||
ByteBuffer buffer = getBufferPool().acquire(accumulator.getLength(), false);
|
||||
try
|
||||
{
|
||||
BufferUtil.clearToFill(buffer);
|
||||
accumulator.transferTo(buffer);
|
||||
newFrame.setPayload(buffer);
|
||||
nextIncomingFrame(newFrame);
|
||||
|
Loading…
x
Reference in New Issue
Block a user