The comment said "treat as non-fatal" but the code calls fail() — which
is correct behavior since we can't write config without a connection.
Updated comment to accurately describe the fail-with-retry-prompt flow.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add isTerminating flag to guard succeed()/fail() against double invocation
from racing didWriteValueFor + didDisconnectPeripheral callbacks
- Only call cancelPeripheralConnection when peripheral.state == .connected
(avoids triggering spurious didDisconnectPeripheral on already-disconnected peripheral)
- Handle disconnect during device info read (post-auth) with specific error message
- Include state info in unexpected disconnect errors for easier debugging
- Early-return structure in disconnect handler for clearer control flow
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>