Merge pull request #4912 from eclipse/jetty-10.0.x-4907-suspendAfterCloseRace

Issue #4907 - close websocket suspendState if close frame is received
This commit is contained in:
Lachlan 2020-07-06 12:54:39 +10:00 committed by GitHub
commit 33852f5137
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -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;
}