Skip to content

Commit b2a5527

Browse files
Thalleycvinayak
authored andcommitted
Bluetooth: Host: Guard set state in conn_destroy
If bt_conn_set_state(conn, BT_CONN_DISCONNECTED) is called while the connection is already disconnected, this triggers a warning. This is likely to happen when bt_conn_cleanup_all is called as part of bt_disable. Added the state check to avoid unnecessary warnings in the log. Signed-off-by: Emil Gydesen <[email protected]> (cherry picked from commit 4a97746) Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent aa6fd02 commit b2a5527

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

subsys/bluetooth/host/conn.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,9 @@ static void conn_destroy(struct bt_conn *conn, void *data)
800800
bt_conn_set_state(conn, BT_CONN_DISCONNECT_COMPLETE);
801801
}
802802

803-
bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
803+
if (conn->state != BT_CONN_DISCONNECTED) {
804+
bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
805+
}
804806
}
805807

806808
void bt_conn_cleanup_all(void)

0 commit comments

Comments
 (0)