Github user martin-g commented on a diff in the pull request: https://github.com/apache/tomcat/pull/42#discussion_r99924137 --- Diff: java/org/apache/tomcat/websocket/WsFrameClient.java --- @@ -58,31 +59,44 @@ void startInputProcessing() { private void processSocketRead() throws IOException { + if (reading.compareAndSet(false, true)) { + while (response.hasRemaining()) { + if (isSuspended()) { + reading.getAndSet(false); + return; + } - while (response.hasRemaining()) { - inputBuffer.mark(); - inputBuffer.position(inputBuffer.limit()).limit(inputBuffer.capacity()); + inputBuffer.mark(); + inputBuffer.position(inputBuffer.limit()).limit(inputBuffer.capacity()); - int toCopy = Math.min(response.remaining(), inputBuffer.remaining()); + int toCopy = Math.min(response.remaining(), inputBuffer.remaining()); - // Copy remaining bytes read in HTTP phase to input buffer used by - // frame processing + // Copy remaining bytes read in HTTP phase to input buffer used by + // frame processing - int orgLimit = response.limit(); - response.limit(response.position() + toCopy); - inputBuffer.put(response); - response.limit(orgLimit); + int orgLimit = response.limit(); + response.limit(response.position() + toCopy); + inputBuffer.put(response); + response.limit(orgLimit); - inputBuffer.limit(inputBuffer.position()).reset(); + inputBuffer.limit(inputBuffer.position()).reset(); - // Process the data we have - processInputBuffer(); - } - response.clear(); + // Process the data we have + try { + processInputBuffer(); + } catch (IOException e) { + reading.getAndSet(false); --- End diff -- `reading.set(false);`
--- 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