diff --git a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandler.java b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandler.java index 96ac6ee8321..dee0c4f033c 100644 --- a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandler.java +++ b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandler.java @@ -204,6 +204,10 @@ public class JettyWebSocketFrameHandler implements FrameHandler default: throw new IllegalStateException(); } + + // If we have received a close frame, set state to closed to disallow further suspends and resumes. + if (frame.getOpCode() == OpCode.CLOSE) + state = SuspendState.CLOSED; } // Send to raw frame handling on user side (eg: WebSocketFrameListener) @@ -296,7 +300,7 @@ public class JettyWebSocketFrameHandler implements FrameHandler { synchronized (this) { - // We are now closed and cannot suspend or resume + // We are now closed and cannot suspend or resume. state = SuspendState.CLOSED; }