Fixed not instantiating cancellation token.

This commit is contained in:
Harrison Deng 2021-04-08 22:22:20 -05:00
parent d4f9cb10bf
commit 3f1836d468

View File

@ -34,6 +34,7 @@ namespace GameServiceWarden.Core.UI
{ {
if (active) throw new InvalidOperationException("IPC already opened."); if (active) throw new InvalidOperationException("IPC already opened.");
active = true; active = true;
stopAcceptingToken = new CancellationTokenSource();
acceptTask = AcceptConnections(); acceptTask = AcceptConnections();
} }
@ -266,7 +267,7 @@ namespace GameServiceWarden.Core.UI
} }
Logger.Log($"Pipe for interface \"{identifier}\" has closed.", LogLevel.DEBUG); Logger.Log($"Pipe for interface \"{identifier}\" has closed.", LogLevel.DEBUG);
(NamedPipeServerStream, Task) removedPipe; (NamedPipeServerStream, Task) removedPipe;
pipes.Remove(identifier, out removedPipe); pipes.TryRemove(identifier, out removedPipe);
await removedPipe.Item1.DisposeAsync(); await removedPipe.Item1.DisposeAsync();
Logger.Log($"Stopped listening to interface \"{identifier}\".", LogLevel.DEBUG); Logger.Log($"Stopped listening to interface \"{identifier}\".", LogLevel.DEBUG);
} }