TunnelsManager: Ability to refresh connection statuses

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-11-09 19:19:32 +05:30
parent 3136fe0e2c
commit 59b9a6e5d2
1 changed files with 14 additions and 0 deletions

View File

@ -208,6 +208,12 @@ class TunnelsManager {
}
tunnel.startDeactivation()
}
func refreshConnectionStatuses() {
for t in tunnels {
t.refreshConnectionStatus()
}
}
}
class TunnelContainer: NSObject {
@ -232,6 +238,14 @@ class TunnelContainer: NSObject {
return (tunnelProvider.protocolConfiguration as! NETunnelProviderProtocol).tunnelConfiguration()
}
func refreshConnectionStatus() {
let status = TunnelStatus(from: self.tunnelProvider.connection.status)
self.status = status
if (status != .inactive) {
startObservingTunnelStatus()
}
}
fileprivate func startActivation(completionHandler: @escaping (Error?) -> Void) {
assert(status == .inactive || status == .restarting)