Revert "TunnelsManager: initialize observer on correct thread"
Rather, we'll make sure we always call startObservingTunnelStatus from
the main thread.
This reverts commit d16a6a167c
.
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
parent
66389c60b5
commit
538704e7bd
|
@ -399,14 +399,13 @@ class TunnelContainer: NSObject {
|
|||
}
|
||||
|
||||
private func startObservingTunnelStatus() {
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let s = self else { return }
|
||||
if (s.statusObservationToken != nil) { return }
|
||||
let connection = s.tunnelProvider.connection
|
||||
s.statusObservationToken = NotificationCenter.default.addObserver(
|
||||
if (statusObservationToken != nil) { return }
|
||||
let connection = tunnelProvider.connection
|
||||
statusObservationToken = NotificationCenter.default.addObserver(
|
||||
forName: .NEVPNStatusDidChange,
|
||||
object: connection,
|
||||
queue: nil) { (_) in
|
||||
queue: nil) { [weak self] (_) in
|
||||
guard let s = self else { return }
|
||||
if ((s.status == .restarting) && (connection.status == .disconnected || connection.status == .disconnecting)) {
|
||||
// Don't change s.status when disconnecting for a restart
|
||||
if (connection.status == .disconnected) {
|
||||
|
@ -422,7 +421,6 @@ class TunnelContainer: NSObject {
|
|||
if (s.status == .inactive) {
|
||||
s.stopObservingTunnelStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue