fix: broaden disconnect retry to cover all active provisioning phases
Previously retry logic only caught disconnects during .authenticating and .writing states. Beacons can also drop during .discoveringServices (characteristic discovery) and .verifying (broadcast check), which would bypass retry and immediately hard-fail. Now all active provisioning phases get the same reconnect retry treatment with backoff delays. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
34e8ea0bab
commit
28aefd1bdf
1 changed files with 3 additions and 2 deletions
|
|
@ -1041,8 +1041,9 @@ extension BeaconProvisioner: CBCentralManagerDelegate {
|
|||
return
|
||||
}
|
||||
|
||||
// Unexpected disconnect during auth or writing — retry with full reconnect
|
||||
if (state == .authenticating || state == .writing) && disconnectRetryCount < BeaconProvisioner.MAX_DISCONNECT_RETRIES {
|
||||
// Unexpected disconnect during any active provisioning phase — retry with full reconnect
|
||||
let isActivePhase = (state == .discoveringServices || state == .authenticating || state == .writing || state == .verifying)
|
||||
if isActivePhase && disconnectRetryCount < BeaconProvisioner.MAX_DISCONNECT_RETRIES {
|
||||
disconnectRetryCount += 1
|
||||
DebugLog.shared.log("BLE: Disconnect during \(state) — reconnecting (attempt \(disconnectRetryCount)/\(BeaconProvisioner.MAX_DISCONNECT_RETRIES))")
|
||||
progress = "Beacon disconnected, reconnecting (\(disconnectRetryCount)/\(BeaconProvisioner.MAX_DISCONNECT_RETRIES))..."
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue