Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove an unnecessary step when stopping the tunnel #1102

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was causing some trouble in the stop pixels not firing, likely because this was causing a delay and the tunnel was killed.

This isn't necessary as it's already done in line 889 anyway.

}

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
Loading