fix: reconnect flap and null-body RST (v1.18.1) - #29
Merged
Merged
Conversation
- Device.Connect immediately replaces any live session (LanDeviceLink::reset): old socket closed, superseded readLoop death ignored silently - Same-IP sightings on live sockets no longer redial; roam repair arrives via phone-initiated inbound or IP-change dials, ending the 2s RST war - reconnectCooldown 10s -> 1s (upstream Android MILLIS_DELAY = 1000ms) - Disconnected sighting dials only target roamed (new-IP) addresses; the backoff loop covers last-known targets so post-drop races stop - TargetDeviceID mismatch demoted to debug log (stale cached IDs) - Aggressive TCP keepalive (30s/10s/3) with legacy fallback on both dial and accept paths; 10s write deadline kills Send-Q zombies - Writer resolves current session per packet, releases pool packets on both success and error paths
Bodyless requests sent explicit "body":null; at least one phone build
aborts the whole link on it (RST seconds after every connect carrying the
contacts UID request). Normalize nil bodies to {} in NewPacket and at both
existing nil-body call sites (contacts sync, SMS conversations).
Drive the roam race (cooldown refusal, replacement, silent superseded close) with per-device event filtering so real-LAN neighbors dialing into :1716 mid-run cannot pollute assertions. Cooldown sleep 11s -> 2s for the 1s window.
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.
Post-roam stability and wire-protocol hotfixes, all verified live against Android 1.35.13 plus unit/race/integration gates.
fix(reconnect): replace zombie sessions, stop self-redial churn
Device.Connectimmediately replaces any live session (LanDeviceLink::reset); superseded deaths stay silentreconnectCooldown10s -> 1s (upstream Android MILLIS_DELAY = 1000ms)fix(protocol): never emit body:null
"body":null; phone aborts the link on it (RST seconds after every connect carrying the contacts UID request). Nil bodies normalize to{}inNewPacket+ both call sites (contacts sync, SMS conversations).fix(test): hermetic duplicate-session integration test
dedup_test.go(cooldown refusal, replacement, silent superseded close) with per-device event filtering so real-LAN neighbors cannot pollute assertions.Verified:
go vet,go test ./...,go test -tags integration -race,golangci-lint, static binary, live Wi-Fi-toggle auto-reconnect (single silent replace, .177 -> .134).