TunnelsManager: Ability to refresh connection statuses

This commit is contained in:
Roopesh Chander 2018-11-09 19:19:32 +05:30
parent c9c58f3755
commit fefa39de46
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)