Skip to content

Commit 04ba412

Browse files
committed
add retainObjectCacheAfterDisconnect option
1 parent f0843df commit 04ba412

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/SwiftOCA/OCP.1/Ocp1Connection.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public let OcaDatagramProxyConnectionPrefix = "oca/dg-proxy"
6767
public struct Ocp1ConnectionFlags: OptionSet, Sendable {
6868
public static let automaticReconnect = Ocp1ConnectionFlags(rawValue: 1 << 0)
6969
public static let refreshDeviceTreeOnConnection = Ocp1ConnectionFlags(rawValue: 1 << 1)
70+
public static let retainObjectCacheAfterDisconnect = Ocp1ConnectionFlags(rawValue: 1 << 2)
7071

7172
public typealias RawValue = UInt
7273

@@ -455,7 +456,10 @@ public extension Ocp1Connection {
455456

456457
func disconnect() async throws {
457458
await removeSubscriptions()
458-
try await disconnectDevice(clearObjectCache: true)
459+
try await disconnectDevice(
460+
clearObjectCache: !options.flags
461+
.contains(.retainObjectCacheAfterDisconnect)
462+
)
459463
}
460464
}
461465

0 commit comments

Comments
 (0)