Github user violetagg commented on a diff in the pull request: https://github.com/apache/tomcat/pull/42#discussion_r100015018 --- Diff: java/org/apache/tomcat/websocket/server/WsFrameServer.java --- @@ -56,21 +61,27 @@ public void onDataAvailable() throws IOException { if (log.isDebugEnabled()) { log.debug("wsFrameServer.onDataAvailable"); } - while (isOpen()) { - // Fill up the input buffer with as much data as we can - inputBuffer.mark(); - inputBuffer.position(inputBuffer.limit()).limit(inputBuffer.capacity()); - int read = socketWrapper.read(false, inputBuffer); - inputBuffer.limit(inputBuffer.position()).reset(); - if (read < 0) { - throw new EOFException(); - } else if (read == 0) { - return; - } - if (log.isDebugEnabled()) { - log.debug(sm.getString("wsFrameServer.bytesRead", Integer.toString(read))); + if (reading.compareAndSet(false, true)) { + try { + while (isOpen() && !isSuspended()) { + // Fill up the input buffer with as much data as we can + inputBuffer.mark(); + inputBuffer.position(inputBuffer.limit()).limit(inputBuffer.capacity()); + int read = socketWrapper.read(false, inputBuffer); + inputBuffer.limit(inputBuffer.position()).reset(); + if (read < 0) { + throw new EOFException(); + } else if (read == 0) { + return; + } + if (log.isDebugEnabled()) { + log.debug(sm.getString("wsFrameServer.bytesRead", Integer.toString(read))); + } + processInputBuffer(); + } + } finally { + reading.getAndSet(false); --- End diff -- applied
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org