Fixing some server tests
This commit is contained in:
parent
5d796488e2
commit
eb07c173ca
|
@ -2,6 +2,7 @@ package org.eclipse.jetty.websocket.io;
|
|||
|
||||
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;
|
||||
|
@ -35,6 +36,7 @@ public class ControlFrameBytes<C> extends FrameBytes<C>
|
|||
{
|
||||
buffer = connection.getBufferPool().acquire(frame.getPayloadLength() + Generator.OVERHEAD,false);
|
||||
connection.getGenerator().generate(frame);
|
||||
BufferUtil.flipToFlush(buffer,0);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.eclipse.jetty.websocket.io;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.websocket.protocol.WebSocketFrame;
|
||||
|
||||
|
@ -48,6 +49,7 @@ public class DataFrameBytes<C> extends FrameBytes<C>
|
|||
}
|
||||
|
||||
buffer = connection.getGenerator().generate(size,frame);
|
||||
BufferUtil.flipToFlush(buffer,0);
|
||||
return buffer;
|
||||
}
|
||||
catch (Throwable x)
|
||||
|
|
|
@ -101,8 +101,9 @@ public class WebSocketAsyncConnection extends AbstractAsyncConnection implements
|
|||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
LOG.warn(e);
|
||||
terminateConnection(StatusCode.PROTOCOL,e.getMessage());
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,10 +215,9 @@ public class WebSocketAsyncConnection extends AbstractAsyncConnection implements
|
|||
@Override
|
||||
public void onFillable()
|
||||
{
|
||||
LOG.debug("onFillable");
|
||||
setCurrentConnection(this);
|
||||
ByteBuffer buffer = bufferPool.acquire(policy.getBufferSize(),false);
|
||||
BufferUtil.clearToFill(buffer);
|
||||
BufferUtil.clear(buffer);
|
||||
try
|
||||
{
|
||||
read(buffer);
|
||||
|
@ -264,6 +264,7 @@ public class WebSocketAsyncConnection extends AbstractAsyncConnection implements
|
|||
break;
|
||||
}
|
||||
|
||||
LOG.debug("Filled {} bytes - {}",filled,BufferUtil.toDetailString(buffer));
|
||||
parser.parse(buffer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -355,9 +355,16 @@ public class BlockheadClient implements Parser.Listener
|
|||
{
|
||||
LOG.debug("write(Frame->{})",frame);
|
||||
frame.setMask(clientmask);
|
||||
// frame.setMask(new byte[] { 0x00, 0x00, 0x00, 0x00 });
|
||||
ByteBuffer buf = generator.generate(frame);
|
||||
BufferUtil.flipToFlush(buf,0);
|
||||
BufferUtil.writeTo(buf,out);
|
||||
if (LOG.isDebugEnabled())
|
||||
{
|
||||
LOG.debug("writing out: {}",BufferUtil.toDetailString(buf));
|
||||
}
|
||||
byte arr[] = BufferUtil.toArray(buf);
|
||||
out.write(arr,0,arr.length);
|
||||
out.flush();
|
||||
}
|
||||
|
||||
public void writeRaw(ByteBuffer buf) throws IOException
|
||||
|
|
Loading…
Reference in New Issue