Bluetooth: tests: hfc: Avoid reconnecting too fast
The host refuses to connect to a peer with an address that is also used by a connection object in disconnected state. Add a guard to prevent `-EINVAL` from `bt_conn_le_create`. Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
This commit is contained in:
parent
fd063d6ae5
commit
03d234d593
1 changed files with 7 additions and 0 deletions
|
@ -81,6 +81,13 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
|
||||||
struct bt_conn *conn;
|
struct bt_conn *conn;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
conn = bt_conn_lookup_addr_le(BT_ID_DEFAULT, addr);
|
||||||
|
if (conn) {
|
||||||
|
LOG_DBG("Old connection is not yet purged");
|
||||||
|
bt_conn_unref(conn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
err = bt_le_scan_stop();
|
err = bt_le_scan_stop();
|
||||||
if (err) {
|
if (err) {
|
||||||
FAIL("Stop LE scan failed (err %d)", err);
|
FAIL("Stop LE scan failed (err %d)", err);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue