diff --git a/Sources/NetworkProtection/PacketTunnelProvider.swift b/Sources/NetworkProtection/PacketTunnelProvider.swift index a197c8a9a..236016c66 100644 --- a/Sources/NetworkProtection/PacketTunnelProvider.swift +++ b/Sources/NetworkProtection/PacketTunnelProvider.swift @@ -887,6 +887,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { @MainActor private func stopTunnel() async throws { connectionStatus = .disconnecting + await stopMonitors() try await stopAdapter() } @@ -895,10 +896,6 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { private func stopAdapter() async throws { try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in adapter.stop { [weak self] error in - if let self { - self.handleAdapterStopped() - } - if let error { self?.debugEvents.fire(error.networkProtectionError) @@ -1420,11 +1417,6 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { try await startMonitors(testImmediately: testImmediately) } - @MainActor - public func handleAdapterStopped() { - connectionStatus = .disconnected - } - // MARK: - Monitors private func startTunnelFailureMonitor() async {