diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/io/FrameBytes.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/io/FrameBytes.java index ff9cb7e0fd9..1dc7571495f 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/io/FrameBytes.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/io/FrameBytes.java @@ -84,7 +84,7 @@ public abstract class FrameBytes implements Callback, Runnable } catch (IOException e) { - WebSocketAsyncConnection.LOG.ignore(e); + LOG.ignore(e); } failed(context, new InterruptedByTimeoutException()); } diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/io/WebSocketAsyncConnection.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/io/WebSocketAsyncConnection.java index b7fbea7ce46..aaf178d6412 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/io/WebSocketAsyncConnection.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/io/WebSocketAsyncConnection.java @@ -49,7 +49,8 @@ import org.eclipse.jetty.websocket.protocol.WebSocketFrame; */ public abstract class WebSocketAsyncConnection extends AbstractAsyncConnection implements RawConnection, OutgoingFrames { - static final Logger LOG = Log.getLogger(WebSocketAsyncConnection.class); + private static final Logger LOG = Log.getLogger(WebSocketAsyncConnection.class); + private static final Logger LOG_FRAMES = Log.getLogger("org.eclipse.jetty.websocket.io.Frames"); private final ByteBufferPool bufferPool; private final ScheduledExecutorService scheduler; @@ -135,6 +136,10 @@ public abstract class WebSocketAsyncConnection extends AbstractAsyncConnection i } flushing = true; + if (LOG.isDebugEnabled()) + { + LOG.debug("Flushing {}, {} frame(s) in queue",frameBytes,queue.size()); + } } write(buffer,this,frameBytes); } @@ -211,7 +216,7 @@ public abstract class WebSocketAsyncConnection extends AbstractAsyncConnection i boolean readMore = false; try { - readMore = read(buffer) == 0; + readMore = (read(buffer) != -1); } finally { @@ -342,9 +347,9 @@ public abstract class WebSocketAsyncConnection extends AbstractAsyncConnection i { AsyncEndPoint endpoint = getEndPoint(); - if (LOG.isDebugEnabled()) + if (LOG_FRAMES.isDebugEnabled()) { - LOG.debug("Writing {} frame bytes of {}",buffer.remaining(),frameBytes); + LOG_FRAMES.debug("{} Writing {} frame bytes of {}",policy.getBehavior(),buffer.remaining(),frameBytes); } try { diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/protocol/Parser.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/protocol/Parser.java index 4de04141cda..1d6b44597b0 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/protocol/Parser.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/protocol/Parser.java @@ -42,6 +42,8 @@ public class Parser PAYLOAD } + private static final Logger LOG_FRAMES = Log.getLogger("org.eclipse.jetty.websocket.io.Frames"); + // State specific private State state = State.START; private int cursor = 0; @@ -107,9 +109,13 @@ public class Parser protected void notifyFrame(final WebSocketFrame f) { + if (LOG_FRAMES.isDebugEnabled()) + { + LOG_FRAMES.debug("{} Read Frame: {}",policy.getBehavior(),f); + } if (LOG.isDebugEnabled()) { - LOG.debug("{} Notify Frame: {} to {}",policy.getBehavior(),f,incomingFramesHandler); + LOG.debug("{} Notify {}",policy.getBehavior(),incomingFramesHandler); } if (incomingFramesHandler == null) {