Skip to content

Commit

Permalink
Use Message.Create to send server shutdown message (#158)
Browse files Browse the repository at this point in the history
* Use Message.Create to send disconnect message on server stop

* Use compact form of message create and send
  • Loading branch information
apkatsikas authored Oct 1, 2024
1 parent 945e4a0 commit 10f4db9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions RiptideNetworking/RiptideNetworking/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 10f4db9

Please sign in to comment.