Retain self weakly for shutdown on timeout
This commit is contained in:
parent
705be661b0
commit
d44d08c95e
|
@ -245,12 +245,15 @@ open class TunnelKitProvider: NEPacketTunnelProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
pendingStopHandler = completionHandler
|
pendingStopHandler = completionHandler
|
||||||
tunnelQueue.schedule(after: .milliseconds(shutdownTimeout)) {
|
tunnelQueue.schedule(after: .milliseconds(shutdownTimeout)) { [weak self] in
|
||||||
guard let pendingHandler = self.pendingStopHandler else {
|
guard let weakSelf = self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.warning("Tunnel not responding after \(self.shutdownTimeout) milliseconds, forcing stop")
|
guard let pendingHandler = weakSelf.pendingStopHandler else {
|
||||||
self.flushLog()
|
return
|
||||||
|
}
|
||||||
|
log.warning("Tunnel not responding after \(weakSelf.shutdownTimeout) milliseconds, forcing stop")
|
||||||
|
weakSelf.flushLog()
|
||||||
pendingHandler()
|
pendingHandler()
|
||||||
}
|
}
|
||||||
tunnelQueue.sync {
|
tunnelQueue.sync {
|
||||||
|
|
Loading…
Reference in New Issue