Skip to content

Commit 82c079d

Browse files
committed
New check for server disconnect
A kill byte isn't received anymore
1 parent 491f56d commit 82c079d

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

osu.Game.Rulesets.Sentakki.Tests/IO/TestSceneGameplayEventBroadcaster.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,20 @@ private async void clientLoop()
148148
{
149149
TransmissionData packet = new TransmissionData(buffer[0]);
150150

151-
// Server has shut down
152-
if (packet == TransmissionData.Kill)
153-
{
154-
// On non-Windows platforms, the client doesn't automatically reconnect
155-
// So we must recreate the client to ensure safety;
156-
pipeClient.Dispose();
157-
pipeClient = new NamedPipeClientStream(".", "senPipe",
158-
PipeDirection.In, PipeOptions.Asynchronous,
159-
TokenImpersonationLevel.Impersonation);
160-
}
161-
162151
if (packet != TransmissionData.Empty)
163152
text.Text = packet.ToString();
164153
}
154+
else if (result == 0) // End of stream reached, meaning that the server disconnected
155+
{
156+
text.Text = TransmissionData.Kill.ToString();
157+
158+
// On non-Windows platforms, the client doesn't automatically reconnect
159+
// So we must recreate the client to ensure safety;
160+
pipeClient.Dispose();
161+
pipeClient = new NamedPipeClientStream(".", "senPipe",
162+
PipeDirection.In, PipeOptions.Asynchronous,
163+
TokenImpersonationLevel.Impersonation);
164+
}
165165
}
166166
catch
167167
{

0 commit comments

Comments
 (0)