-
Notifications
You must be signed in to change notification settings - Fork 38
VPN is sometimes stopped twice #1213
Conversation
| } | ||
|
|
||
| Logger.networkProtection.error("🔴 Stopping VPN due to no auth token") | ||
| await cancelTunnel(with: TunnelError.startingTunnelWithoutAuthToken) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
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.
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.
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