diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-05-12 01:03:28 +0200 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-05-12 01:03:28 +0200 |
commit | e1271e1dc9e9ba865a6e5aed46379cd803154588 (patch) | |
tree | 65e91693d1a8f39e2fc62063216896c34f129ed0 | |
parent | 17fc923d7b749d1817ab26e52ab6eecfb6999eac (diff) | |
download | nrf-softdevice-e1271e1dc9e9ba865a6e5aed46379cd803154588.zip |
Fix unexpected event on disconnect during l2cap setup.
Fixes #110
-rw-r--r-- | nrf-softdevice/src/ble/l2cap.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/nrf-softdevice/src/ble/l2cap.rs b/nrf-softdevice/src/ble/l2cap.rs index 33a2baa..ab366e1 100644 --- a/nrf-softdevice/src/ble/l2cap.rs +++ b/nrf-softdevice/src/ble/l2cap.rs @@ -167,6 +167,12 @@ impl<P: Packet> L2cap<P> { raw::BLE_GAP_EVTS_BLE_GAP_EVT_DISCONNECTED => { return Err(SetupError::Disconnected) } + raw::BLE_L2CAP_EVTS_BLE_L2CAP_EVT_CH_RELEASED => { + // It is possible to get L2CAP_EVT_CH_RELEASED for the + // "half-setup" channel if the conn gets disconnected while + // setting it up. + return Err(SetupError::Disconnected); + } raw::BLE_L2CAP_EVTS_BLE_L2CAP_EVT_CH_SETUP => { let l2cap_evt = get_union_field(ble_evt, &(*ble_evt).evt.l2cap_evt); let _evt = &l2cap_evt.params.ch_setup; |