From 98bdb3cf0d39ea3dc193bda3954d2919011ef0b6 Mon Sep 17 00:00:00 2001 From: Matthias Heil Date: Thu, 12 Nov 2026 07:28:23 +0100 Subject: [PATCH] public async Task StartAsync() { if (_client?.State == PipeState.Connected) return; --- PipeClient/ServerConnection.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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() {