Skip to content

Commit 8b85d97

Browse files
committed
always call resumeAllNotConnected() when connection is disconnected
there is no recovery for existing requests, all continuations must resume with failure
1 parent ffbdaa0 commit 8b85d97

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/SwiftOCA/OCP.1/Ocp1Connection.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,10 @@ open class Ocp1Connection: CustomStringConvertible, ObservableObject {
242242
do {
243243
try await receiveMessages(connection)
244244
} catch Ocp1Error.notConnected {
245+
resumeAllNotConnected()
245246
if await connection.options.flags.contains(.automaticReconnect) {
246247
try await connection.reconnectDevice()
247248
} else {
248-
resumeAllNotConnected()
249249
throw Ocp1Error.notConnected
250250
}
251251
}
@@ -261,7 +261,7 @@ open class Ocp1Connection: CustomStringConvertible, ObservableObject {
261261
}
262262
}
263263

264-
func resumeAllNotConnected() {
264+
private func resumeAllNotConnected() {
265265
_continuations.withCriticalRegion { continuations in
266266
for continuation in continuations.values {
267267
continuation.resume(throwing: Ocp1Error.notConnected)

0 commit comments

Comments
 (0)