From 82c079d32a2d6250bfdc19a334cb6ed8896f3a0a Mon Sep 17 00:00:00 2001 From: Derrick Timmermans Date: Sun, 26 Sep 2021 14:03:35 +0200 Subject: [PATCH] New check for server disconnect A kill byte isn't received anymore --- .../IO/TestSceneGameplayEventBroadcaster.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Sentakki.Tests/IO/TestSceneGameplayEventBroadcaster.cs b/osu.Game.Rulesets.Sentakki.Tests/IO/TestSceneGameplayEventBroadcaster.cs index 9fe32ee99..a11cdd679 100644 --- a/osu.Game.Rulesets.Sentakki.Tests/IO/TestSceneGameplayEventBroadcaster.cs +++ b/osu.Game.Rulesets.Sentakki.Tests/IO/TestSceneGameplayEventBroadcaster.cs @@ -148,20 +148,20 @@ private async void clientLoop() { TransmissionData packet = new TransmissionData(buffer[0]); - // Server has shut down - if (packet == TransmissionData.Kill) - { - // On non-Windows platforms, the client doesn't automatically reconnect - // So we must recreate the client to ensure safety; - pipeClient.Dispose(); - pipeClient = new NamedPipeClientStream(".", "senPipe", - PipeDirection.In, PipeOptions.Asynchronous, - TokenImpersonationLevel.Impersonation); - } - if (packet != TransmissionData.Empty) text.Text = packet.ToString(); } + else if (result == 0) // End of stream reached, meaning that the server disconnected + { + text.Text = TransmissionData.Kill.ToString(); + + // On non-Windows platforms, the client doesn't automatically reconnect + // So we must recreate the client to ensure safety; + pipeClient.Dispose(); + pipeClient = new NamedPipeClientStream(".", "senPipe", + PipeDirection.In, PipeOptions.Asynchronous, + TokenImpersonationLevel.Impersonation); + } } catch {