Issue #6566 - cleanups of ByteBufferCallbackAccumulator
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
83f2265653
commit
1dce9df48d
|
@ -15,7 +15,6 @@ package org.eclipse.jetty.io;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
|
@ -74,19 +73,16 @@ public class ByteBufferCallbackAccumulator
|
|||
|
||||
public void writeTo(ByteBuffer buffer)
|
||||
{
|
||||
for (Iterator<Entry> iterator = _entries.iterator(); iterator.hasNext();)
|
||||
if (BufferUtil.space(buffer) < _length)
|
||||
throw new IllegalArgumentException("not enough buffer space remaining");
|
||||
|
||||
for (Entry entry : _entries)
|
||||
{
|
||||
Entry entry = iterator.next();
|
||||
_length -= entry.buffer.remaining();
|
||||
buffer.put(entry.buffer);
|
||||
iterator.remove();
|
||||
entry.callback.succeeded();
|
||||
}
|
||||
|
||||
if (!_entries.isEmpty())
|
||||
throw new IllegalStateException("remaining entries: " + _entries.size());
|
||||
if (_length != 0)
|
||||
throw new IllegalStateException("non-zero length: " + _length);
|
||||
_entries.clear();
|
||||
_length = 0;
|
||||
}
|
||||
|
||||
public void fail(Throwable t)
|
||||
|
|
|
@ -156,8 +156,8 @@ public abstract class DispatchedMessageSink extends AbstractMessageSink
|
|||
@Override
|
||||
public void succeeded()
|
||||
{
|
||||
session.demand(1);
|
||||
super.succeeded();
|
||||
session.demand(1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -326,7 +326,7 @@ public class JettyWebSocketFrameHandler implements FrameHandler
|
|||
if (activeMessageSink == null)
|
||||
{
|
||||
callback.succeeded();
|
||||
coreSession.demand(1);
|
||||
demand();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue