TunnelsManager: Handle deactivation of a waiting tunnel

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-12-10 16:28:41 +05:30
parent 707f292e4e
commit b491b9c371
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()
}