mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2025-02-20 14:52:16 +00:00
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) {
|
||||||
@ -422,7 +421,6 @@ class TunnelContainer: NSObject {
|
|||||||
if (s.status == .inactive) {
|
if (s.status == .inactive) {
|
||||||
s.stopObservingTunnelStatus()
|
s.stopObservingTunnelStatus()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user