Skip to content

fix: count reconnect attempts across failed handshakes - #89

Merged
nmbrone merged 1 commit into
mainfrom
fix/reconnect-backoff
Sep 3, 2026
Merged

fix: count reconnect attempts across failed handshakes#89
nmbrone merged 1 commit into
mainfrom
fix/reconnect-backoff

Conversation

@nmbrone

@nmbrone nmbrone commented Sep 3, 2026

Copy link
Copy Markdown
Owner

conn_attempt was set to 1 as soon as the upgrade request had been sent, so any server that accepted TCP and then rejected the handshake — or dropped the session — reset the counter every round. handle_disconnect/3 always saw attempt 1, so the default backoff stayed at its 200ms minimum instead of growing.

Counting moves to handle_disconnect/2, which covers every disconnect path; the reset happens only in the Mint.WebSocket.new/4 success branch, where the handshake has actually completed.

`conn_attempt` was set to 1 as soon as the upgrade request had been sent, so a
server that accepted the TCP connection and then rejected the handshake, or
dropped the session, reset the counter on every round. `handle_disconnect/3`
always saw attempt 1, which pinned the default backoff at its 200ms minimum.

Count in `handle_disconnect/2` instead, and reset only where the handshake
actually completes.
@nmbrone
nmbrone merged commit 45b70be into main Sep 3, 2026
4 checks passed
@nmbrone
nmbrone deleted the fix/reconnect-backoff branch September 3, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants