From 10f4db9b99ea2af1459cdb71d3073680d0a34ad2 Mon Sep 17 00:00:00 2001 From: Andrew Katsikas Date: Tue, 1 Oct 2024 12:07:04 -0400 Subject: [PATCH] Use Message.Create to send server shutdown message (#158) * Use Message.Create to send disconnect message on server stop * Use compact form of message create and send --- RiptideNetworking/RiptideNetworking/Server.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/RiptideNetworking/RiptideNetworking/Server.cs b/RiptideNetworking/RiptideNetworking/Server.cs index d8a9fdfc..b7024cb4 100644 --- a/RiptideNetworking/RiptideNetworking/Server.cs +++ b/RiptideNetworking/RiptideNetworking/Server.cs @@ -468,9 +468,7 @@ public void Stop() return; pendingConnections.Clear(); - byte[] disconnectBytes = { (byte)MessageHeader.Disconnect, (byte)DisconnectReason.ServerStopped }; - foreach (Connection client in clients.Values) - client.Send(disconnectBytes, disconnectBytes.Length); + SendToAll(Message.Create(MessageHeader.Disconnect).AddByte((byte)DisconnectReason.ServerStopped)); clients.Clear(); transport.Shutdown();