From ebefc7bd5466a35402f8e9524ac9fda7a3a60c10 Mon Sep 17 00:00:00 2001 From: mjj4791 Date: Thu, 27 Dec 2018 01:29:22 +0100 Subject: [PATCH] Free resources to prevent limited functionality In HandleConnection, free/close reader and server connections, to allow these to be used by the next task. If not free-ed, this will only allow the interprocess communication to work twice... --- SingleInstanceManager/SingleInstanceManager.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SingleInstanceManager/SingleInstanceManager.cs b/SingleInstanceManager/SingleInstanceManager.cs index 5714e21..13e7815 100644 --- a/SingleInstanceManager/SingleInstanceManager.cs +++ b/SingleInstanceManager/SingleInstanceManager.cs @@ -139,7 +139,10 @@ private async Task HandleConnection(CancellationToken cancellationToken) // raise the event OnSecondInstanceStarted(args); - + // close reader & server to free resources + // otherwise, the inter process communication will only work twice... + reader.Close(); + server.Close(); } @@ -158,4 +161,4 @@ public void Dispose() _cts?.Dispose(); } } -} \ No newline at end of file +}