Skip to content

Commit d7f4ac8

Browse files
authored
fix: stop vpn binary on startup failure (#150)
The vpn binary doesn't exit by itself on failure to avoid messing up RPC calls, so the parent process is expected to stop it.
1 parent efb60ca commit d7f4ac8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Vpn.Service/Manager.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ await _tunnelSupervisor.StartAsync(_config.TunnelBinaryPath, HandleTunnelRpcMess
172172
if (reply.MsgCase != TunnelMessage.MsgOneofCase.Start)
173173
throw new InvalidOperationException("Tunnel did not reply with a Start response");
174174

175+
// If the tunnel failed to start, stop the subprocess.
176+
if (!reply.Start.Success)
177+
await _tunnelSupervisor.StopAsync(ct);
178+
175179
await BroadcastStatus(reply.Start.Success ? TunnelStatus.Started : TunnelStatus.Stopped, ct);
176180
return reply.Start;
177181
}

0 commit comments

Comments
 (0)