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() {
|
private func startObservingTunnelStatus() {
|
||||||
DispatchQueue.main.async { [weak self] in
|
if (statusObservationToken != nil) { return }
|
||||||
guard let s = self else { return }
|
let connection = tunnelProvider.connection
|
||||||
if (s.statusObservationToken != nil) { return }
|
statusObservationToken = NotificationCenter.default.addObserver(
|
||||||
let connection = s.tunnelProvider.connection
|
|
||||||
s.statusObservationToken = NotificationCenter.default.addObserver(
|
|
||||||
forName: .NEVPNStatusDidChange,
|
forName: .NEVPNStatusDidChange,
|
||||||
object: connection,
|
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)) {
|
if ((s.status == .restarting) && (connection.status == .disconnected || connection.status == .disconnecting)) {
|
||||||
// Don't change s.status when disconnecting for a restart
|
// Don't change s.status when disconnecting for a restart
|
||||||
if (connection.status == .disconnected) {
|
if (connection.status == .disconnected) {
|
||||||
|
@ -424,7 +423,6 @@ class TunnelContainer: NSObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private func stopObservingTunnelStatus() {
|
private func stopObservingTunnelStatus() {
|
||||||
DispatchQueue.main.async { [weak self] in
|
DispatchQueue.main.async { [weak self] in
|
||||||
|
|
Loading…
Reference in New Issue