Skip to content

android: fix double close when VPN is revoked#742

Merged
kari-ts merged 1 commit intomainfrom
kari/notif
Feb 23, 2026
Merged

android: fix double close when VPN is revoked#742
kari-ts merged 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
-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
@kari-ts kari-ts merged commit 3ec1358 into main Feb 23, 2026
4 checks passed
@kari-ts kari-ts deleted the kari/notif branch February 23, 2026 22:38
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

2 participants