From bc2bbb426f82f00e446ca274e9f8a926f6f9dbc0 Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Wed, 23 Jul 2025 14:07:06 +1000 Subject: [PATCH] fix: stop vpn binary on startup failure --- Vpn.Service/Manager.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Vpn.Service/Manager.cs b/Vpn.Service/Manager.cs index fdb62af..027a882 100644 --- a/Vpn.Service/Manager.cs +++ b/Vpn.Service/Manager.cs @@ -172,6 +172,10 @@ await _tunnelSupervisor.StartAsync(_config.TunnelBinaryPath, HandleTunnelRpcMess if (reply.MsgCase != TunnelMessage.MsgOneofCase.Start) throw new InvalidOperationException("Tunnel did not reply with a Start response"); + // If the tunnel failed to start, stop the subprocess. + if (!reply.Start.Success) + await _tunnelSupervisor.StopAsync(ct); + await BroadcastStatus(reply.Start.Success ? TunnelStatus.Started : TunnelStatus.Stopped, ct); return reply.Start; }