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; }