public async Task StartAsync()
{
if (_client?.State == PipeState.Connected)
return;
This commit is contained in:
@@ -5,7 +5,7 @@ using System.Diagnostics;
|
||||
namespace PipeClient;
|
||||
|
||||
/// <summary>
|
||||
/// Owns the server process and the pipe client connected to it.
|
||||
/// Manages a pipe client and any server process it starts.
|
||||
/// </summary>
|
||||
internal sealed class ServerConnection(string pipeName, Action<string> log) : IDisposable
|
||||
{
|
||||
@@ -19,6 +19,9 @@ internal sealed class ServerConnection(string pipeName, Action<string> 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<string> log) : ID
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Kills the (unresponsive) server process and starts a new one.
|
||||
/// Kills the owned server process, if any, and starts a new one.
|
||||
/// </summary>
|
||||
public async Task KillAndRestartAsync()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user