samples: Bluetooth: Add missing bt_conn_ref for a few samples
Some samples were missing a call to bt_conn_ref when assigning default_conn. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
8924d5c6be
commit
452b897aec
3 changed files with 3 additions and 3 deletions
|
@ -426,7 +426,7 @@ static void connected(struct bt_conn *conn, uint8_t err)
|
||||||
default_conn = NULL;
|
default_conn = NULL;
|
||||||
return;
|
return;
|
||||||
} else if (role == ROLE_PERIPHERAL) {
|
} else if (role == ROLE_PERIPHERAL) {
|
||||||
default_conn = conn;
|
default_conn = bt_conn_ref(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INF("Connected: %s", addr);
|
LOG_INF("Connected: %s", addr);
|
||||||
|
|
|
@ -79,7 +79,7 @@ static void connected(struct bt_conn *conn, uint8_t err)
|
||||||
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
|
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
|
||||||
|
|
||||||
if (default_conn == NULL) {
|
if (default_conn == NULL) {
|
||||||
default_conn = conn;
|
default_conn = bt_conn_ref(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn != default_conn) {
|
if (conn != default_conn) {
|
||||||
|
|
|
@ -222,7 +222,7 @@ static void connected(struct bt_conn *conn, uint8_t err)
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("Connected: %s\n", addr);
|
printk("Connected: %s\n", addr);
|
||||||
default_conn = conn;
|
default_conn = bt_conn_ref(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disconnected(struct bt_conn *conn, uint8_t reason)
|
static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue