survive disconnect during BLE MTU lookup

This commit is contained in:
Jay
2026-08-18 14:26:11 -04:00
parent d86212be9d
commit 4bf00eb583
5 changed files with 35 additions and 3 deletions
+6
View File
@@ -340,6 +340,12 @@ static trikke_transport_status_t ble_poll_once(void *context)
portEXIT_CRITICAL(&ble->lock);
const uint16_t mtu = ble_att_mtu(connection_handle);
if (mtu == 0) {
// The connection can disappear after the locked state snapshot above.
// The GAP callback advances the delivery epoch; retain ownership and
// let a later poll restart the frame after resubscription.
return TRIKKE_TRANSPORT_PENDING;
}
if (mtu <= 3 + TRIKKE_BLE_FRAGMENT_HEADER_SIZE) {
return TRIKKE_TRANSPORT_FATAL;
}