-
Notifications
You must be signed in to change notification settings - Fork 35
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
Fix VPN toggle failures #858
Conversation
@@ -88,7 +88,9 @@ public class ConnectionErrorObserverThroughSession: ConnectionErrorObserver { | |||
|
|||
private func handleStatusChangeNotification(_ notification: Notification) { | |||
do { | |||
guard let session = ConnectionSessionUtilities.session(from: notification) else { | |||
guard let session = ConnectionSessionUtilities.session(from: notification), | |||
session.status == .disconnected else { |
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.
We don't need error information if the VPN is connected.
@@ -98,6 +98,10 @@ public class ConnectionServerInfoObserverThroughSession: ConnectionServerInfoObs | |||
// MARK: - Obtaining the NetP VPN status | |||
|
|||
private func updateServerInfo(session: NETunnelProviderSession) async { | |||
guard session.status == .connected else { |
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.
We only need server info if the VPN is connected.
@@ -99,7 +99,9 @@ public class DataVolumeObserverThroughSession: DataVolumeObserver { | |||
|
|||
private func updateDataVolume() { | |||
Task { | |||
guard let session = await tunnelSessionProvider.activeSession() else { | |||
guard let session = await tunnelSessionProvider.activeSession(), | |||
session.status == .connected else { |
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.
We only need data volume if the VPN is connected.
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.
LGTM. Will validate changes in client PRs.
Task/Issue URL: https://app.asana.com/0/1207603085593419/1207629954356116/f iOS PR: duckduckgo/iOS#2979 BSK PR: duckduckgo/BrowserServicesKit#858 ## Description The VPN toggle is sometimes failing silently, apparently due to a race condition created by calls to `sendProviderMessage` while the VPN is starting up. This PR changes our logic to limit when those calls are made, since none of them make sense to call when the VPN is connecting.
Task/Issue URL: https://app.asana.com/0/1207603085593419/1207629954356116/f macOS PR: duckduckgo/macos-browser#2892 BSK PR: duckduckgo/BrowserServicesKit#858 ## Description The VPN toggle is sometimes failing silently, apparently due to a race condition created by calls to `sendProviderMessage` while the VPN is starting up. This PR changes our logic to limit when those calls are made, since none of them make sense to call when the VPN is connecting.
Task/Issue URL: https://app.asana.com/0/1207603085593419/1207629954356116/f
iOS PR: duckduckgo/iOS#2979
macOS PR: duckduckgo/macos-browser#2892
What kind of version bump will this require?: Patch
Description
The VPN toggle is sometimes failing silently, apparently due to a race condition created by calls to
sendProviderMessage
while the VPN is starting up.This PR changes our logic to limit when those calls are made, since none of them make sense to call when the VPN is connecting.
Testing
See platform-specific PRs for instructions.
Internal references:
Software Engineering Expectations
Technical Design Template