Skip to content

Commit ef6087e

Browse files
committed
unconditionally disconnect after monitor failure
not just if automaticReconnect is enabled
1 parent e5dccac commit ef6087e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/SwiftOCA/OCP.1/Ocp1Connection+Connect.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,10 @@ extension Ocp1Connection {
350350
if _connectionState.value != .notConnected {
351351
// don't update connection state if we were explicitly disconnected
352352
_updateConnectionState(error.ocp1ConnectionState)
353+
try await _disconnectDeviceAfterConnectionFailure()
353354
}
354355

355356
if _automaticReconnect, error._isRecoverableConnectionError {
356-
try await _disconnectDeviceAfterConnectionFailure()
357357
Task.detached { try await self.reconnectDeviceWithBackoff() }
358358
}
359359
}

0 commit comments

Comments
 (0)