Skip to content

Commit

Permalink
Merge pull request #11086 from jetty/jetty-12.0.x-11081-websocketRace
Browse files Browse the repository at this point in the history
Issue #11081 - fix race condition in WebSocket FrameHandlers (jetty-12)
  • Loading branch information
sbordet authored Dec 29, 2023
2 parents 965e4af + 37a296d commit 2505d0e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,10 @@ private void acceptFrame(Frame frame, Callback callback)
}

// Accept the payload into the message sink.
activeMessageSink.accept(frame, callback);
MessageSink messageSink = activeMessageSink;
if (frame.isFin())
activeMessageSink = null;
messageSink.accept(frame, callback);
}

boolean isAutoDemand()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,10 @@ private void acceptMessage(Frame frame, Callback callback)
}

// Accept the payload into the message sink
activeMessageSink.accept(frame, callback);
MessageSink messageSink = activeMessageSink;
if (frame.isFin())
activeMessageSink = null;
messageSink.accept(frame, callback);
}

public void onPing(Frame frame, Callback callback)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,10 @@ private void acceptMessage(Frame frame, Callback callback)
}

// Accept the payload into the message sink
activeMessageSink.accept(frame, callback);
MessageSink messageSink = activeMessageSink;
if (frame.isFin())
activeMessageSink = null;
messageSink.accept(frame, callback);
}

public void onPing(Frame frame, Callback callback)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,10 @@ private void acceptMessage(Frame frame, Callback callback)
}

// Accept the payload into the message sink
activeMessageSink.accept(frame, callback);
MessageSink messageSink = activeMessageSink;
if (frame.isFin())
activeMessageSink = null;
messageSink.accept(frame, callback);
}

private void onBinaryFrame(Frame frame, Callback callback)
Expand Down

0 comments on commit 2505d0e

Please sign in to comment.