Skip to content

Conversation

@encrypt94
Copy link
Collaborator

@encrypt94 encrypt94 commented Jan 22, 2026

Description

Fix VPN-6774 by adding new StateConnectionError to Controller to properly handle connection failures caused by server unavailability (e.g. switching to or connecting to an offline server).
Server unavailable events now trigger a transition to this new state, which displays a dedicated error view and updates the systray with a red status indicator.

Screenshot from 2026-01-29 17-47-08

Also, fixes a bug where the connection timer remain stuck after a server-unavailable error on first connection with a subsequent successful connection.

Reference

Jira Issue

Checklist

  • My code follows the style guidelines for this project
  • I have not added any packages that contain high risk or unknown licenses (GPL, LGPL, MPL, etc. consult with DevOps if in question)
  • I have performed a self review of my own code
  • I have commented my code PARTICULARLY in hard to understand areas
  • I have added thorough tests where needed

@encrypt94 encrypt94 marked this pull request as draft January 22, 2026 17:25
@encrypt94 encrypt94 changed the title Fix VPN-6774: VPN cannot be turned OFF after the server unavailable modal is closed draft: Fix VPN-6774: VPN cannot be turned OFF after the server unavailable modal is closed Jan 22, 2026
@encrypt94 encrypt94 changed the title draft: Fix VPN-6774: VPN cannot be turned OFF after the server unavailable modal is closed [draft] Fix VPN-6774: VPN cannot be turned OFF after the server unavailable modal is closed Jan 22, 2026
Copy link
Collaborator

@artfwo artfwo left a comment

Choose a reason for hiding this comment

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

LGTM, but maybe we also need to consider alerting the user, especially in the 'server not responding case'

Upd: re-reviewing following Slack discussion.

@artfwo artfwo self-requested a review January 23, 2026 13:37
@encrypt94
Copy link
Collaborator Author

encrypt94 commented Jan 27, 2026

Fix VPN-6774 by setting StateOff when serverUnavailable is called while in StateConnecting (attempting to connect to a server marked as unavailable), or calling deactivate when called during an attempt to connect to or switch to an offline server that has not yet been marked as unavailable.

As this may lead to traffic leaks in some scenarios, let's change the approach to fix this bug and add a new StateConnectionError in the Controller, with Error m_errorCode to keep track of the error type.

Three different scenario where identified that leads to a server unavailable condition:

  1. User tries to connect to a group of servers flagged as unavailable (tbh i'm not even sure this can happen in real world)
    • All servers in the city are flag as  unavailable but pre selected on the app serverUnavailable is triggered by Controller::activateInternal here or below
    • Controller remains in StateConnecting
    • Tunnel is not setup leaks can happen
    • VPN can be switch off with toggle if enabled but a "Background service error" appears as there is nothing to deactivate
    • From here we can only go to StateOff or choose a new server and go StateConfirming
  2. User tries to connect to an offline group of servers still not flagged as unavailableserverUnavailable is triggered by Controller::handshakeTimeout
    • Controller remains in StateConfirming
    • Tunnel is setup no leaks
    • If popup is closed VPN can be switched off by the enableDisconnecInConfirming, but server list is not clickabl
  3. User tries to switch from a working server to an offline group of servers not flagged as unavailable
    • ServerUnavailable is triggered by Controller::handShakeTimeout
    • Controller remains in StateSwitching
    • Tunnel is setup, no leaks
    • If popup is closed VPN cannot be switched off with toggle and server list is not clickable, if we enable the toggle it can be switched off safely

2 and 3 are fixed, 1 may unlikely lead to traffic leaks and needs discussion

… in timer being locked to zero when successully connecting after a server unavailable error
…connection error screen is showed and vpn toggle is clickable when popup is ignored
@encrypt94 encrypt94 changed the title [draft] Fix VPN-6774: VPN cannot be turned OFF after the server unavailable modal is closed Fix VPN-6774: VPN cannot be turned OFF after the server unavailable modal is closed Jan 29, 2026
@encrypt94 encrypt94 marked this pull request as ready for review January 29, 2026 17:16
@encrypt94 encrypt94 requested review from artfwo and oskirby January 29, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants