Update device state with unlock error

This commit is contained in:
Christoph Hagen 2024-03-11 00:41:26 +01:00
parent e0e2a1cb06
commit db5311074a

View File

@ -75,7 +75,8 @@ final class DeviceManager {
throw MessageResult.invalidServerAuthenticationFromRemote throw MessageResult.invalidServerAuthenticationFromRemote
} }
guard let socket = connection, !socket.isClosed else { guard let socket = connection, !socket.isClosed else {
connection = nil // Ensure that metric is updated
didCloseDeviceSocket()
throw MessageResult.deviceNotConnected throw MessageResult.deviceNotConnected
} }
guard receivedMessageData == nil else { guard receivedMessageData == nil else {
@ -169,6 +170,9 @@ final class DeviceManager {
func didCloseDeviceSocket() { func didCloseDeviceSocket() {
connection = nil connection = nil
Task {
await updateDeviceConnectionMetrics()
}
} }
func removeDeviceConnection() async { func removeDeviceConnection() async {