diff --git a/PipeClient/ServerConnection.cs b/PipeClient/ServerConnection.cs index 8ceda48..2e5255b 100644 --- a/PipeClient/ServerConnection.cs +++ b/PipeClient/ServerConnection.cs @@ -5,7 +5,7 @@ using System.Diagnostics; namespace PipeClient; /// -/// Owns the server process and the pipe client connected to it. +/// Manages a pipe client and any server process it starts. /// internal sealed class ServerConnection(string pipeName, Action log) : IDisposable { @@ -19,6 +19,9 @@ internal sealed class ServerConnection(string pipeName, Action log) : ID public async Task StartAsync() { + if (_client?.State == PipeState.Connected) + return; + var process = StartServerProcess(PipeName); process.EnableRaisingEvents = true; process.Exited += (_, _) => @@ -34,7 +37,7 @@ internal sealed class ServerConnection(string pipeName, Action log) : ID } /// - /// Kills the (unresponsive) server process and starts a new one. + /// Kills the owned server process, if any, and starts a new one. /// public async Task KillAndRestartAsync() {