Skip to content

Commit

Permalink
Removes an unnecessary step from the tunnel stop process
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoreymendez committed Nov 28, 2024
1 parent 5a24a88 commit cab867b
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions Sources/NetworkProtection/PacketTunnelProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@ open class PacketTunnelProvider: NEPacketTunnelProvider {
@MainActor
private func stopTunnel() async throws {
connectionStatus = .disconnecting

await stopMonitors()
try await stopAdapter()
}
Expand All @@ -895,10 +896,6 @@ open class PacketTunnelProvider: NEPacketTunnelProvider {
private func stopAdapter() async throws {
try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<Void, Error>) in
adapter.stop { [weak self] error in
if let self {
self.handleAdapterStopped()
}

if let error {
self?.debugEvents.fire(error.networkProtectionError)

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit cab867b

Please sign in to comment.