Bluetooth: ISO: Handle central disc of pending CIS
If the central disconnects a CIS while it is being established, then we receive both a CIS established event with BT_HCI_ERR_OP_CANCELLED_BY_HOST and a disconnect complete event. In this case we should not call bt_iso_disconnected in the CIS established event handler, as that will also be called from the disconnect complete event handler. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
7e66bb1e09
commit
1e50132237
1 changed files with 12 additions and 5 deletions
|
@ -1035,8 +1035,14 @@ void hci_le_cis_established(struct net_buf *buf)
|
||||||
/* ISO connection handles are already assigned at this point */
|
/* ISO connection handles are already assigned at this point */
|
||||||
iso = bt_conn_lookup_handle(handle, BT_CONN_TYPE_ISO);
|
iso = bt_conn_lookup_handle(handle, BT_CONN_TYPE_ISO);
|
||||||
if (!iso) {
|
if (!iso) {
|
||||||
|
/* If it is a local disconnect, then we may have received the disconnect complete
|
||||||
|
* event before this event, and in which case we do not expect to find the CIS
|
||||||
|
* object
|
||||||
|
*/
|
||||||
|
if (evt->status != BT_HCI_ERR_OP_CANCELLED_BY_HOST) {
|
||||||
LOG_ERR("No connection found for handle %u", handle);
|
LOG_ERR("No connection found for handle %u", handle);
|
||||||
bt_conn_unref(iso);
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1107,10 +1113,11 @@ void hci_le_cis_established(struct net_buf *buf)
|
||||||
bt_conn_set_state(iso, BT_CONN_CONNECTED);
|
bt_conn_set_state(iso, BT_CONN_CONNECTED);
|
||||||
bt_conn_unref(iso);
|
bt_conn_unref(iso);
|
||||||
return;
|
return;
|
||||||
}
|
} else if (evt->status != BT_HCI_ERR_OP_CANCELLED_BY_HOST) {
|
||||||
|
|
||||||
iso->err = evt->status;
|
iso->err = evt->status;
|
||||||
bt_iso_disconnected(iso);
|
bt_iso_disconnected(iso);
|
||||||
|
} /* else we wait for disconnect event */
|
||||||
|
|
||||||
bt_conn_unref(iso);
|
bt_conn_unref(iso);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue