Repository navigation
Discard stale WebSocket state when reconnecting - #617
Merged
Merged
Conversation
Discard queued wire frames, partial receive data, receive targets and fragment assembly state before a new client or server handshake. Old connection data must not be replayed or joined with a new connection's messages. Serialize handshakes with active application sends, releasing the write lock before Open callbacks so callbacks can still send normally. This prevents an interrupted fragmented send from appending old continuations after the new session's reset. Add loopback regressions for automatic reconnect, partial frames, queued output, failed reconnect attempts and a send paused between fragments. The tests fail without the reset; removing send coordination independently reproduces cross-connection continuation writes. Fixes #610 Fixes #611
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a connection drops during a fragmented receive or a backpressured send, the transport retains state from that session. A reconnect can combine
OLDfrom the previous connection withNEWfrom the next, or send an old frame tail before the next message.Reset queued output, incomplete receive data, receive targets and fragment assembly state before a new client or server handshake. Finish any active application send before resetting and replacing the transport, so it cannot append old continuation frames after the reset. The wait remains cancellable so a send progress callback can call
stop()without deadlocking. Release the write lock before Open callbacks so those callbacks can send normally.Queued bytes belong to their original connection and are discarded on reconnect; this does not add automatic message replay.
Validation:
git diff --checkpassed.Fixes #610.
Fixes #611.