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:
Szymon Janc 2018-10-09 02:34:18 +02:00 committed by Carles Cufí
commit b732a9a69b

View file

@ -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);