Skip to content

Commit 5e44280

Browse files
committed
stop WebSockets async pool monitor before closing socket
1 parent 1260208 commit 5e44280

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/SwiftOCA/OCP.1/Backend/Ocp1FlyingSocksConnection.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ private actor AsyncSocketPoolMonitor {
9595
return pool
9696
}
9797

98+
func stop() {
99+
task?.cancel()
100+
task = nil
101+
}
102+
98103
deinit {
99104
if let task {
100105
task.cancel()
@@ -138,6 +143,7 @@ public class Ocp1FlyingSocksConnection: Ocp1Connection {
138143
}
139144

140145
override public func disconnectDevice(clearObjectCache: Bool) async throws {
146+
await AsyncSocketPoolMonitor.shared.stop()
141147
if let asyncSocket {
142148
try asyncSocket.close()
143149
self.asyncSocket = nil

0 commit comments

Comments
 (0)