Bluetooth: host: Clear auto-conn state when failed to get conn object
Make sure that the auto-conn state is cleared correctly when we might fail to allocate a new connection object. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
a0349689ff
commit
a45226a238
1 changed files with 6 additions and 6 deletions
|
@ -1273,6 +1273,12 @@ static void enh_conn_complete(struct bt_hci_evt_le_enh_conn_complete *evt)
|
||||||
if (IS_ENABLED(CONFIG_BT_CENTRAL) &&
|
if (IS_ENABLED(CONFIG_BT_CENTRAL) &&
|
||||||
IS_ENABLED(CONFIG_BT_WHITELIST) &&
|
IS_ENABLED(CONFIG_BT_WHITELIST) &&
|
||||||
evt->role == BT_HCI_ROLE_MASTER) {
|
evt->role == BT_HCI_ROLE_MASTER) {
|
||||||
|
/*
|
||||||
|
* Clear auto conn even if we are not able to add connection
|
||||||
|
* object to keep the host in sync with controller state.
|
||||||
|
*/
|
||||||
|
atomic_clear_bit(bt_dev.flags, BT_DEV_AUTO_CONN);
|
||||||
|
|
||||||
/* for whitelist initiator me may need to add new connection. */
|
/* for whitelist initiator me may need to add new connection. */
|
||||||
if (!conn) {
|
if (!conn) {
|
||||||
conn = bt_conn_add_le(BT_ID_DEFAULT, &id_addr);
|
conn = bt_conn_add_le(BT_ID_DEFAULT, &id_addr);
|
||||||
|
@ -1326,12 +1332,6 @@ static void enh_conn_complete(struct bt_hci_evt_le_enh_conn_complete *evt)
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_CENTRAL) &&
|
if (IS_ENABLED(CONFIG_BT_CENTRAL) &&
|
||||||
conn->role == BT_HCI_ROLE_MASTER) {
|
conn->role == BT_HCI_ROLE_MASTER) {
|
||||||
if (IS_ENABLED(CONFIG_BT_WHITELIST) &&
|
|
||||||
atomic_test_bit(bt_dev.flags, BT_DEV_AUTO_CONN)) {
|
|
||||||
conn->id = BT_ID_DEFAULT;
|
|
||||||
atomic_clear_bit(bt_dev.flags, BT_DEV_AUTO_CONN);
|
|
||||||
}
|
|
||||||
|
|
||||||
bt_addr_le_copy(&conn->le.resp_addr, &peer_addr);
|
bt_addr_le_copy(&conn->le.resp_addr, &peer_addr);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_PRIVACY)) {
|
if (IS_ENABLED(CONFIG_BT_PRIVACY)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue