-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Description
Recently I encountered some runtime panics, the following is the log:
DEBUG on_data_length_update conn_handle=4 max_rx_octets=251 max_rx_time_us=2120 max_tx_octets=251 max_tx_time_us=2120
└─ nrf_softdevice::ble::gap::on_evt @ /Users/haobogu/.cargo/git/checkouts/nrf-softdevice-03ef4aef10e777e4/d5f023b/nrf-softdevice/src/fmt.rs:125
DEBUG on_conn_param_update conn_handle=4 conn_sup_timeout=100 max_conn_interval=12 min_conn_interval=12 slave_latency=4
└─ nrf_softdevice::ble::gap::on_evt @ /Users/haobogu/.cargo/git/checkouts/nrf-softdevice-03ef4aef10e777e4/d5f023b/nrf-softdevice/src/fmt.rs:125
ERROR panicked at 'unexpected event 59'
└─ nrf_softdevice::ble::gatt_client::att_mtu_exchange::{async_fn#0}::{closure#2} @ /Users/haobogu/.cargo/git/checkouts/nrf-softdevice-03ef4aef10e777e4/d5f023b/nrf-softdevice/src/fmt.rs:101
ERROR panicked at /Users/haobogu/.cargo/registry/src/rsproxy.cn-0dccff568467c15b/defmt-0.3.10/src/lib.rs:380:5:
explicit panic
└─ panic_probe::print_defmt::print @ /Users/haobogu/.cargo/registry/src/rsproxy.cn-0dccff568467c15b/panic-probe-0.3.2/src/lib.rs:104
It seems that there's a timeout when exchanging mtu:
nrf-softdevice/nrf-softdevice/src/ble/gatt_client.rs
Lines 589 to 608 in b53991e
| portal(conn_handle) | |
| .wait_once(|ble_evt| unsafe { | |
| match (*ble_evt).header.evt_id as u32 { | |
| raw::BLE_GAP_EVTS_BLE_GAP_EVT_DISCONNECTED => return Err(MtuExchangeError::Disconnected), | |
| raw::BLE_GATTC_EVTS_BLE_GATTC_EVT_EXCHANGE_MTU_RSP => { | |
| let gattc_evt = match check_status(ble_evt) { | |
| Ok(evt) => evt, | |
| Err(e) => return Err(e.into()), | |
| }; | |
| let params = get_union_field(ble_evt, &gattc_evt.params.exchange_mtu_rsp); | |
| let mtu = params.server_rx_mtu; | |
| debug!("att mtu exchange: got mtu {:?}", mtu); | |
| conn.with_state(|state| state.att_mtu = mtu); | |
| Ok(()) | |
| } | |
| e => panic!("unexpected event {}", e), | |
| } | |
| }) | |
| .await |
Is there any methods to avoid this panic or manually handle it?
Metadata
Metadata
Assignees
Labels
No labels