Bluetooth: Fix connection type check in bt_conn_lookup_state
Change-Id: I543b18ecaa714c1c15ed45b5bc911272dd13b49a Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
d2f90fad61
commit
ad425d4dae
3 changed files with 11 additions and 7 deletions
|
@ -688,7 +688,7 @@ struct bt_conn *bt_conn_lookup_addr_le(const bt_addr_le_t *peer)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct bt_conn *bt_conn_lookup_state(const bt_addr_le_t *peer,
|
||||
struct bt_conn *bt_conn_lookup_state_le(const bt_addr_le_t *peer,
|
||||
const bt_conn_state_t state)
|
||||
{
|
||||
int i;
|
||||
|
@ -698,6 +698,10 @@ struct bt_conn *bt_conn_lookup_state(const bt_addr_le_t *peer,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (conns[i].type != BT_CONN_TYPE_LE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bt_addr_le_cmp(peer, BT_ADDR_LE_ANY) &&
|
||||
bt_addr_le_cmp(peer, &conns[i].le.dst)) {
|
||||
continue;
|
||||
|
|
|
@ -120,7 +120,7 @@ struct bt_conn *bt_conn_lookup_handle(uint16_t handle);
|
|||
/* Look up a connection state. For BT_ADDR_LE_ANY, returns the first connection
|
||||
* with the specific state
|
||||
*/
|
||||
struct bt_conn *bt_conn_lookup_state(const bt_addr_le_t *peer,
|
||||
struct bt_conn *bt_conn_lookup_state_le(const bt_addr_le_t *peer,
|
||||
const bt_conn_state_t state);
|
||||
|
||||
/* Set connection object in certain state and perform action related to state */
|
||||
|
|
|
@ -528,7 +528,7 @@ static void le_conn_complete(struct net_buf *buf)
|
|||
/* Make lookup to check if there's a connection object in CONNECT state
|
||||
* associated with passed peer LE address.
|
||||
*/
|
||||
conn = bt_conn_lookup_state(id_addr, BT_CONN_CONNECT);
|
||||
conn = bt_conn_lookup_state_le(id_addr, BT_CONN_CONNECT);
|
||||
|
||||
if (evt->status) {
|
||||
if (!conn) {
|
||||
|
@ -726,7 +726,7 @@ static void check_pending_conn(const bt_addr_le_t *id_addr,
|
|||
return;
|
||||
}
|
||||
|
||||
conn = bt_conn_lookup_state(id_addr, BT_CONN_CONNECT_SCAN);
|
||||
conn = bt_conn_lookup_state_le(id_addr, BT_CONN_CONNECT_SCAN);
|
||||
if (!conn) {
|
||||
return;
|
||||
}
|
||||
|
@ -1264,7 +1264,7 @@ int bt_le_scan_update(bool fast_scan)
|
|||
}
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_CENTRAL)
|
||||
conn = bt_conn_lookup_state(BT_ADDR_LE_ANY, BT_CONN_CONNECT_SCAN);
|
||||
conn = bt_conn_lookup_state_le(BT_ADDR_LE_ANY, BT_CONN_CONNECT_SCAN);
|
||||
if (!conn) {
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue