Issue #6566 - do not duplicate size count for binary MessageSinks
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
bd396f867b
commit
fd6c72c668
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue