Skip to content

Comments

android: fix double close when VPN is revoked#742

Open
kari-ts wants to merge 1 commit intomainfrom
kari/notif
Open

android: fix double close when VPN is revoked#742
kari-ts wants to merge 1 commit intomainfrom
kari/notif

Conversation

@kari-ts
Copy link
Collaborator

@kari-ts kari-ts commented Feb 20, 2026

When the VPN is disconnected, stopSelf() triggers onDestroy(), which calls close(). onRevoke() also calls close(). Both these calls do serviceDisconnect on the service, sending the service to the onDisconnect channel twice. This fix:

-only calls CloseTuns for the current VPN service (unconditional call was killing the newly established VPN) -calls setWantRunning(false) when a VPN revokes Tailscale to -check permissions and prepare VPN service before starting the VPN, since VPN permission is revoked in onRevoke

Fixes tailscale/tailscale#17190

When the VPN is disconnected, stopSelf() triggers onDestroy(), which calls close(). onRevoke() also calls close(). Both these calls do serviceDisconnect on the service, sending the service to the onDisconnect channel twice. This fix:

-only calls CloseTuns for the current VPN service (unconditional call was killing the newly established VPN)
-calls setWantRunning(false) when a VPN revokes Tailscale to
-check permissions and prepare VPN service before starting the VPN, since VPN permission is revoked in onRevoke

Fixes tailscale/tailscale#17190

Signed-off-by: kari-ts <kari@tailscale.com>
@kari-ts kari-ts requested a review from barnstar February 20, 2026 21:03
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.

Android Tailscale needs to be force stopped to connect after using another VPN

1 participant