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 <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
fcf089574d
commit
4a97746312
@ -852,7 +852,9 @@ static void conn_destroy(struct bt_conn *conn, void *data)
|
||||
bt_conn_set_state(conn, BT_CONN_DISCONNECT_COMPLETE);
|
||||
}
|
||||
|
||||
bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
|
||||
if (conn->state != BT_CONN_DISCONNECTED) {
|
||||
bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
|
||||
}
|
||||
}
|
||||
|
||||
void bt_conn_cleanup_all(void)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user