Skip to content

Commit 3430eb6

Browse files
committed
Enable simultaneous background process interruption
1 parent 1715e9f commit 3430eb6

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

bindings/batteries/ChannelManagerConstructor.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,14 @@ public class ChannelManagerConstructor: NativeTypeWrapper {
177177

178178
}
179179

180-
public func interrupt() {
181-
print("stopping background processor")
180+
public func interrupt(tcpPeerHandler: TCPPeerHandler? = nil) {
182181
self.shutdown = true
182+
if let tcpHandler = tcpPeerHandler {
183+
print("stopping TCP peer handler")
184+
tcpHandler.interrupt()
185+
print("stopped TCP peer handler")
186+
}
187+
print("stopping background processor")
183188
self.backgroundProcessor?.dangle().stop()
184189
print("stopped background processor")
185190
if let processor = self.backgroundProcessor {

ci/LDKSwift/Tests/LDKSwiftTests/HumanObjectPeerTestInstance.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ public class HumanObjectPeerTestInstance {
282282
XCTAssertEqual(connectedPeersA.count, 1)
283283
XCTAssertEqual(connectedPeersB.count, 1)
284284

285-
peer1.constructor?.interrupt()
286-
peer2.constructor?.interrupt()
285+
peer1.constructor?.interrupt(tcpPeerHandler: peer1.tcpSocketHandler)
286+
peer2.constructor?.interrupt(tcpPeerHandler: peer2.tcpSocketHandler)
287287

288288
}
289289

0 commit comments

Comments
 (0)