Coming to grips with windowed write

This commit is contained in:
Joakim Erdfelt 2012-07-18 09:36:16 -07:00
parent 99e7b9becc
commit 6350470e3f
2 changed files with 13 additions and 2 deletions

View File

@ -19,10 +19,13 @@ import java.nio.ByteBuffer;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.protocol.WebSocketFrame;
public class DataFrameBytes<C> extends FrameBytes<C>
{
private static final Logger LOG = Log.getLogger(DataFrameBytes.class);
private int size;
private ByteBuffer buffer;
@ -34,6 +37,11 @@ public class DataFrameBytes<C> extends FrameBytes<C>
@Override
public void completed(C context)
{
if (LOG.isDebugEnabled())
{
LOG.debug("completed({}) - frame.remaining() = {}",context,frame.remaining());
}
connection.getBufferPool().release(buffer);
if (frame.remaining() > 0)

View File

@ -340,14 +340,17 @@ public class WebSocketAsyncConnection extends AbstractAsyncConnection implements
private <C> void write(ByteBuffer buffer, WebSocketAsyncConnection webSocketAsyncConnection, FrameBytes<C> frameBytes)
{
AsyncEndPoint endpoint = getEndPoint();
if (LOG.isDebugEnabled())
{
LOG.debug("Writing {} frame bytes of {}",buffer.remaining(),frameBytes);
LOG.debug("EndPoint: {}",getEndPoint());
LOG.debug("EndPoint: {}",endpoint);
}
try
{
getEndPoint().write(frameBytes.context,frameBytes,buffer);
endpoint.write(frameBytes.context,frameBytes,buffer);
// endpoint.flush();
}
catch (Throwable t)
{