Bluetooth: host: Compile master role conn complete conditionally
Connection complete event with error code can be received only for central role and can be compiled conditionally. Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This commit is contained in:
parent
f1c67615cf
commit
b732a9a69b
1 changed files with 23 additions and 19 deletions
|
@ -805,20 +805,21 @@ static void le_enh_conn_complete(struct bt_hci_evt_le_enh_conn_complete *evt)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (evt->status) {
|
||||
/*
|
||||
* if there was an error we are only interested in pending
|
||||
* connection so there is no need to check ID address as
|
||||
* only one connection can be in that state
|
||||
*
|
||||
* Depending on error code address might not be valid anyway.
|
||||
*/
|
||||
conn = find_pending_connect(NULL);
|
||||
if (!conn) {
|
||||
return;
|
||||
}
|
||||
if (IS_ENABLED(CONFIG_BT_CENTRAL)) {
|
||||
if (evt->status) {
|
||||
/*
|
||||
* if there was an error we are only interested in pending
|
||||
* connection so there is no need to check ID address as
|
||||
* only one connection can be in that state
|
||||
*
|
||||
* Depending on error code address might not be valid anyway.
|
||||
*/
|
||||
conn = find_pending_connect(NULL);
|
||||
if (!conn) {
|
||||
return;
|
||||
}
|
||||
|
||||
conn->err = evt->status;
|
||||
conn->err = evt->status;
|
||||
|
||||
/*
|
||||
* Handle advertising timeout after high duty directed
|
||||
|
@ -828,14 +829,17 @@ static void le_enh_conn_complete(struct bt_hci_evt_le_enh_conn_complete *evt)
|
|||
atomic_clear_bit(bt_dev.flags, BT_DEV_ADVERTISING);
|
||||
}
|
||||
|
||||
bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
|
||||
bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
|
||||
|
||||
/* check if device is market for auto connect */
|
||||
if (atomic_test_bit(conn->flags, BT_CONN_AUTO_CONNECT)) {
|
||||
bt_conn_set_state(conn, BT_CONN_CONNECT_SCAN);
|
||||
/* check if device is market for auto connect */
|
||||
if (atomic_test_bit(conn->flags, BT_CONN_AUTO_CONNECT)) {
|
||||
bt_conn_set_state(conn, BT_CONN_CONNECT_SCAN);
|
||||
}
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
||||
goto done;
|
||||
} else {
|
||||
BT_ASSERT(evt->status == 0);
|
||||
}
|
||||
|
||||
bt_addr_le_copy(&id_addr, &evt->peer_addr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue