Commit 33e7595
committed
fix(relay): fix reconnection after sleep/wake and stale connections
The relay reconnection logic had a bug where stale connections detected
after system sleep/wake would not trigger reconnection:
1. handleStaleConnection() set status to DISCONNECTED before calling
onDisconnect(), so when onDisconnect() checked if status was CONNECTED,
it was already DISCONNECTED and wouldn't call handleReconnection()
2. Removed MAX_RECONNECT_ATTEMPTS limit (was 5) - relays now retry
indefinitely with capped backoff (max 30 seconds between attempts)
The fix makes handleStaleConnection() directly call handleReconnection()
after cleaning up the dead WebSocket, ensuring reconnection is always
attempted when a stale connection is detected.1 parent c8ab6d9 commit 33e7595
1 file changed
+24
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
124 | 123 | | |
125 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
126 | 143 | | |
127 | 144 | | |
128 | 145 | | |
| |||
668 | 685 | | |
669 | 686 | | |
670 | 687 | | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
680 | 691 | | |
681 | 692 | | |
682 | 693 | | |
| |||
0 commit comments