survive disconnect during BLE MTU lookup
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user