Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Conversation

@diegoreymendez
Copy link
Contributor

@diegoreymendez diegoreymendez commented Feb 5, 2025

Task/Issue URL: https://app.asana.com/0/1207603085593419/1209322889682604/f

iOS PR: duckduckgo/iOS#3928
macOS PR: duckduckgo/macos-browser#3829

What kind of version bump will this require?: Patch

Description

Fixes an issue where the tunnel is being stopped twice.

Testing

Please refer to the platform-specific PRs for testing instructions.


Internal references:

Software Engineering Expectations
Technical Design Template

@diegoreymendez diegoreymendez self-assigned this Feb 5, 2025
}

Logger.networkProtection.error("🔴 Stopping VPN due to no auth token")
await cancelTunnel(with: TunnelError.startingTunnelWithoutAuthToken)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need to cancel the tunnel if we're throwing an error below, which is the right way to cancel startup.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, yeah good catch.

return "Failed to generate a tunnel configuration: \(internalError.localizedDescription)"
case .simulateTunnelFailureError:
return "Simulated a tunnel error as requested"
case .tokenReset:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Differentiating a specific case that was previously reported as startingTunnelWithoutAuthToken.

// in case an error in the controller on the client side allows it.
try await tokenHandler.removeToken()
throw TunnelError.startingTunnelWithoutAuthToken
try? await tokenHandler.removeToken()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even if this fails, this isn't the real failure reason - the real failure reason is the token is being removed which, as described above, is an abnormal scenario. The removal failing shouldn't be the error we get.

} catch {
Logger.networkProtection.fault("Error force-refreshing token container: \(error, privacy: .public)\n \(newTokenContainer.refreshToken, privacy: .public)")
throw TunnelError.startingTunnelWithoutAuthToken
throw TunnelError.startingTunnelWithoutAuthToken(internalError: error)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just taking advantage that there's underlying error info.

@diegoreymendez diegoreymendez merged commit ab64a66 into main Feb 7, 2025
7 checks passed
@diegoreymendez diegoreymendez deleted the diego/fix-tunnel-stop-issues branch February 7, 2025 09:07
diegoreymendez added a commit to duckduckgo/iOS that referenced this pull request Feb 7, 2025
Task/Issue URL:
https://app.asana.com/0/1207603085593419/1209322889682604/f

macOS PR: duckduckgo/macos-browser#3829
BSK PR: duckduckgo/BrowserServicesKit#1213

**Description**:

Fixes an issue where the tunnel is being stopped twice.
diegoreymendez added a commit to duckduckgo/macos-browser that referenced this pull request Feb 7, 2025
Task/Issue URL:
https://app.asana.com/0/1207603085593419/1209322889682604/f

iOS PR: duckduckgo/iOS#3928
BSK PR: duckduckgo/BrowserServicesKit#1213

**Description**:

Fixes an issue where the tunnel is being stopped twice.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants