Skip to content

fix(cluster): restore auto-reconnect after failed connection attempt (#2380)#2394

Merged
ten9876 merged 1 commit intomainfrom
auto/fixcluster-restore-auto-reconnect-after-failed-con
May 6, 2026
Merged

fix(cluster): restore auto-reconnect after failed connection attempt (#2380)#2394
ten9876 merged 1 commit intomainfrom
auto/fixcluster-restore-auto-reconnect-after-failed-con

Conversation

@ten9876
Copy link
Copy Markdown
Owner

@ten9876 ten9876 commented May 6, 2026

Summary

Cherry-picks @M7HNF-Ian's cluster auto-reconnect fix from PR #2388 onto a clean base. The rest of his branch contained already-merged commits (#2349 Spot Lines toggle and #2386 TCI crash fix), the rejected #2387 spectrum fix, and two drive-by spots-naming refinements that belong in their own focused PR.

Closes #2380.

Bug

SpotHub (DX cluster / RBN) didn't automatically reconnect after a Wi-Fi drop or any failed connection attempt. The app would try once when the network came back, fail, and stop retrying — requiring a manual reconnect.

Root cause

Qt's QAbstractSocket only emits disconnected() on a Connected → Unconnected transition. When a socket fails during ConnectingState (host blocked, refused, or timed out), Qt emits errorOccurred but not disconnected. The reconnect timer was only armed inside onDisconnected(), so a single failed connect attempt permanently halted the backoff chain. Two additional failure paths had the same gap: onSocketError() emitted the UI error only and never re-armed the timer, and the 10-second connect-timeout lambda called abort() without scheduling a retry.

Fix

Extracts a scheduleReconnect() helper called from all three failure paths, with two guards — m_intentionalDisconnect (don't override user-initiated disconnect) and m_reconnectTimer->isActive() (prevents double-scheduling when errorOccurred and the connect timeout both fire for the same failed attempt). A per-call epoch counter captured by the timeout lambda ensures a stale timeout from attempt N cannot abort a later attempt N+1 that has since succeeded. connectToCluster() also now rejects calls when the socket is already in ConnectingState to prevent overlapping attempts during rapid retries.

Backoff sequence unchanged: 5 s → 10 s → 20 s → 40 s → 60 s (cap).

Hardware-validated

@ten9876 tested against a real cluster on FLEX-8600 fw 4.1.5: firewall-block triggers retries at the expected intervals; unblock mid-backoff connects without manual intervention; user-initiated disconnect doesn't auto-retry; backoff resets on successful reconnect.

Reported by luigiverdicchio1-prog (Lou) on Windows 10 with a FLEX-6400.

Co-authored-by: Ian M7HNF [email protected]
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]

…2380)

SpotHub (DX cluster / RBN) did not automatically reconnect after a Wi-Fi
drop or any other failed connection attempt. The app would try once when
the network came back, fail, and stop retrying — requiring a manual
reconnect.

Root cause: Qt's QAbstractSocket only emits disconnected() on a Connected
→ Unconnected transition. When a socket fails during ConnectingState
(host blocked, refused, or timed out), Qt emits errorOccurred but NOT
disconnected. The reconnect timer was only armed inside onDisconnected(),
so a single failed connect attempt permanently halted the backoff chain.

Two additional failure paths had the same gap: onSocketError() emitted
the UI error only and never re-armed the timer, and the 10-second connect
timeout lambda called abort() without scheduling a retry.

Fix: extracts a scheduleReconnect() helper called from all three failure
paths, with two guards — m_intentionalDisconnect (don't override
user-initiated disconnect) and m_reconnectTimer->isActive() (prevents
double-scheduling when errorOccurred and the connect timeout both fire
for the same failed attempt). A per-call epoch counter (m_connectEpoch)
captured by the timeout lambda ensures a stale timeout from attempt N
cannot abort a later attempt N+1 that has since succeeded.
connectToCluster() also now rejects calls when the socket is already in
ConnectingState to prevent overlapping attempts during rapid retries.

Backoff sequence is unchanged: 5 s → 10 s → 20 s → 40 s → 60 s (cap).

Cherry-picked from PR #2388 (M7HNF-Ian). The rest of that branch contained
already-merged commits (#2349 Spot Lines toggle, #2386 TCI crash fix), the
rejected #2387 spectrum fix, and two unrelated spot-lines naming-refinement
commits that belong in their own focused PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@ten9876 ten9876 requested a review from jensenpat as a code owner May 6, 2026 02:28
@ten9876 ten9876 enabled auto-merge (squash) May 6, 2026 02:28
@ten9876 ten9876 merged commit a847239 into main May 6, 2026
5 checks passed
@ten9876 ten9876 deleted the auto/fixcluster-restore-auto-reconnect-after-failed-con branch May 6, 2026 02:58
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.

Sport Hub Auto connect not working

2 participants