TunnelsManager: Handle deactivation of a waiting tunnel

This commit is contained in:
Roopesh Chander 2018-12-10 16:28:41 +05:30
parent 42729a0fe7
commit 66bb9c94d4
1 changed files with 6 additions and 1 deletions

View File

@ -402,8 +402,13 @@ class TunnelContainer: NSObject {
}
fileprivate func startDeactivation() {
assert(status == .active || status == .waiting)
let session = (tunnelProvider.connection as! NETunnelProviderSession)
if (status == .waiting && (session.status == .disconnected || session.status == .invalid)) {
status = .inactive
self.onDeactivationComplete?()
self.onDeactivationComplete = nil
return
}
session.stopTunnel()
}