Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions libre3/src/main/kotlin/app/aaps/libre3/Libre3BleClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,10 @@ class Libre3BleClient(
}
is Libre3SecuritySession.Step.Failed -> {
listener.onError(step.reason)
disconnect()
// A failed handshake step is recoverable: the next clean connect re-runs it from
// scratch. Do NOT call disconnect() — that sets `stopping` and permanently kills
// reconnection (same trap the onCharacteristicWrite path warns about). Retry instead.
scheduleReconnect()
}
}
}
Expand Down Expand Up @@ -425,7 +428,11 @@ class Libre3BleClient(
when (val result = r.offer(value)) {
is Libre3Framing.Reassembler.Result.NeedMore -> Unit
is Libre3Framing.Reassembler.Result.Error -> {
listener.onError("reassembly: ${result.reason}"); disconnect()
// An out-of-order / dropped BLE frame mid-handshake is a transient radio glitch,
// not a reason to stop forever. disconnect() sets `stopping` and permanently
// disables reconnection (observed live 2026-11-20: 3 h with no BG). scheduleReconnect()
// tears down the GATT and re-handshakes cleanly on backoff.
listener.onError("reassembly: ${result.reason}"); scheduleReconnect()
}
is Libre3Framing.Reassembler.Result.Complete -> {
reassembler = null
Expand Down
Loading