Merge pull request #11084 from jetty/jetty-10.0.x-11081-websocketRace

Issue #11081 - fix race condition in WebSocket FrameHandlers
This commit is contained in:
Lachlan 2023-12-20 12:07:00 +11:00 committed by GitHub
commit 1fb3f313ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -596,9 +596,10 @@ public class JavaxWebSocketFrameHandler implements FrameHandler
} }
// Accept the payload into the message sink // Accept the payload into the message sink
activeMessageSink.accept(frame, callback); MessageSink messageSink = activeMessageSink;
if (frame.isFin()) if (frame.isFin())
activeMessageSink = null; activeMessageSink = null;
messageSink.accept(frame, callback);
} }
public void onPing(Frame frame, Callback callback) public void onPing(Frame frame, Callback callback)

View File

@ -345,9 +345,10 @@ public class JettyWebSocketFrameHandler implements FrameHandler
} }
// Accept the payload into the message sink // Accept the payload into the message sink
activeMessageSink.accept(frame, callback); MessageSink messageSink = activeMessageSink;
if (frame.isFin()) if (frame.isFin())
activeMessageSink = null; activeMessageSink = null;
messageSink.accept(frame, callback);
} }
private void onBinaryFrame(Frame frame, Callback callback) private void onBinaryFrame(Frame frame, Callback callback)