Commit a847239
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: Ian M7HNF <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 2d915d7 commit a847239
2 files changed
Lines changed: 32 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
121 | 125 | | |
122 | 126 | | |
123 | 127 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 128 | + | |
131 | 129 | | |
132 | 130 | | |
133 | 131 | | |
134 | 132 | | |
135 | 133 | | |
136 | 134 | | |
137 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
138 | 154 | | |
139 | 155 | | |
140 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
| 83 | + | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
| |||
0 commit comments