Skip to content
Commit b3ffaf44 authored by Timothy Keys's avatar Timothy Keys Committed by Benjamin Cabé
Browse files

Bluetooth: Host: Cancel pending deferred work on disconnect



This fixes an issue that occurred if deferred_work is queued by another
procedure before we run bt_conn_set_state(BT_CONN_DISCONNECTED).
bt_conn_set_state yields to the system work queue in bt_conn_tx_notify,
and then deferred_work runs and handles the disconnected callbacks.
bt_conn_set_state then enqueues another deferred_work which calls the
disconnected callbacks again and causes an assert. k_work_cancel_delayable
will clear queued deferred work when we call
bt_conn_set_state(BT_CONN_DISCONNECTED), guaranteeing that the disconnect
callbacks will only be called once.

Signed-off-by: default avatarTimothy Keys <timothy.keys@nordicsemi.no>
parent 4c96cbb7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment