Skip to content

Commit

Permalink
Merge pull request #4912 from eclipse/jetty-10.0.x-4907-suspendAfterC…
Browse files Browse the repository at this point in the history
…loseRace

Issue #4907 - close websocket suspendState if close frame is received
  • Loading branch information
lachlan-roberts authored Jul 6, 2020
2 parents 3454401 + 50b62c3 commit 33852f5
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ public void onFrame(Frame frame, Callback callback)
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)
Expand Down Expand Up @@ -296,7 +300,7 @@ public void onClosed(CloseStatus closeStatus, Callback callback)
{
synchronized (this)
{
// We are now closed and cannot suspend or resume
// We are now closed and cannot suspend or resume.
state = SuspendState.CLOSED;
}

Expand Down

0 comments on commit 33852f5

Please sign in to comment.