Revert "TunnelsManager: initialize observer on correct thread"
Rather, we'll make sure we always call startObservingTunnelStatus from
the main thread.
This reverts commit d16a6a167c
.
This commit is contained in:
parent
c0c1fddb75
commit
395e6fcdda
|
@ -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) {
|
||||
|
@ -424,7 +423,6 @@ class TunnelContainer: NSObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func stopObservingTunnelStatus() {
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
|
|
Loading…
Reference in New Issue