fix: cancel the previous close timer when starting a handshake - #93
Closed
nmbrone wants to merge 1 commit into
Closed
fix: cancel the previous close timer when starting a handshake#93nmbrone wants to merge 1 commit into
nmbrone wants to merge 1 commit into
Conversation
`send_close/2` overwrote `close_timer` without cancelling it, and `close/1` only cancels the timer it can see. Two handshakes inside the 5s window left the first timer armed, so it fired after the connection had been closed and re-established, and tore down the healthy connection.
Owner
Author
|
Folded into #92 — the timer cancel is what makes the new |
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.
send_close/2overwroteclose_timerwithout cancelling it, andclose/1only cancels the timer it can see. Two handshakes inside the 5s window — a server close frame arriving, then a callback returning{:close, code, reason, state}before the socket drops — left the first timer armed. It fired after the connection had been closed and re-established, tearing down the healthy connection.No test: observing it black-box means waiting out the 5s timer and catching a spurious disconnect on the reconnected client. The alternatives are a 5s test, reading a private timer ref via
:sys.get_state, or making the timeout configurable purely for tests — none of which seemed worth it for a one-line fix.