Fixing WebSocketAsyncConnection.write() of byte[] arrays
This commit is contained in:
parent
4fd7ff76fb
commit
8aa6e5db9b
|
@ -4,7 +4,6 @@ import java.nio.ByteBuffer;
|
|||
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.websocket.generator.Generator;
|
||||
import org.eclipse.jetty.websocket.protocol.OpCode;
|
||||
import org.eclipse.jetty.websocket.protocol.WebSocketFrame;
|
||||
|
||||
|
@ -34,8 +33,7 @@ public class ControlFrameBytes<C> extends FrameBytes<C>
|
|||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
buffer = connection.getBufferPool().acquire(frame.getPayloadLength() + Generator.OVERHEAD,false);
|
||||
connection.getGenerator().generate(frame);
|
||||
buffer = connection.getGenerator().generate(frame);
|
||||
BufferUtil.flipToFlush(buffer,0);
|
||||
}
|
||||
return buffer;
|
||||
|
|
|
@ -354,6 +354,7 @@ public class WebSocketFrame implements Frame
|
|||
data = ByteBuffer.allocate(len);
|
||||
BufferUtil.clearToFill(data);
|
||||
data.put(buf,0,len);
|
||||
BufferUtil.flipToFill(data);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ public class WebSocketServletRFCTest
|
|||
int ccCount = 0;
|
||||
|
||||
ByteBuffer echod = binmsg.getPayload();
|
||||
while (echod.remaining() > 1)
|
||||
while (echod.remaining() >= 1)
|
||||
{
|
||||
byte b = echod.get();
|
||||
switch (b)
|
||||
|
|
Loading…
Reference in New Issue