Issue #6566 - do not duplicate size count for binary MessageSinks

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2021-08-24 10:54:00 +10:00
parent bd396f867b
commit fd6c72c668
2 changed files with 2 additions and 6 deletions

View File

@ -29,7 +29,6 @@ public class ByteArrayMessageSink extends AbstractMessageSink
{
private static final byte[] EMPTY_BUFFER = new byte[0];
private BufferCallbackAccumulator out;
private int size;
public ByteArrayMessageSink(CoreSession session, MethodHandle methodHandle)
{
@ -49,7 +48,7 @@ public class ByteArrayMessageSink extends AbstractMessageSink
{
try
{
size += frame.getPayloadLength();
long size = (out == null ? 0 : out.getLength()) + frame.getPayloadLength();
long maxBinaryMessageSize = session.getMaxBinaryMessageSize();
if (maxBinaryMessageSize > 0 && size > maxBinaryMessageSize)
{
@ -104,7 +103,6 @@ public class ByteArrayMessageSink extends AbstractMessageSink
{
// reset
out = null;
size = 0;
}
}
}

View File

@ -30,7 +30,6 @@ import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException;
public class ByteBufferMessageSink extends AbstractMessageSink
{
private BufferCallbackAccumulator out;
private int size;
public ByteBufferMessageSink(CoreSession session, MethodHandle methodHandle)
{
@ -50,7 +49,7 @@ public class ByteBufferMessageSink extends AbstractMessageSink
{
try
{
size += frame.getPayloadLength();
long size = (out == null ? 0 : out.getLength()) + frame.getPayloadLength();
long maxBinaryMessageSize = session.getMaxBinaryMessageSize();
if (maxBinaryMessageSize > 0 && size > maxBinaryMessageSize)
{
@ -113,7 +112,6 @@ public class ByteBufferMessageSink extends AbstractMessageSink
if (frame.isFin())
{
out = null;
size = 0;
}
}
}