From a00348dac1cd9f76ad040fae68a2e30b8567d90b Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sun, 23 Oct 2022 21:28:05 +0200 Subject: [PATCH] Dispose all connections when shutting down a server --- OpenRA.Game/Server/Server.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index ed44ae4e30..dc348fb4a5 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -49,7 +49,7 @@ namespace OpenRA.Server public readonly MersenneTwister Random = new MersenneTwister(); public readonly ServerType Type; - public List Conns = new List(); + public readonly List Conns = new List(); public Session LobbyInfo; public ServerSettings Settings; @@ -392,6 +392,10 @@ namespace OpenRA.Server foreach (var t in serverTraits.WithInterface()) t.ServerShutdown(this); + // Make sure to immediately close connections after the server is shutdown, we don't want to keep clients waiting + foreach (var c in Conns) + c.Dispose(); + Conns.Clear(); }) { IsBackground = true }.Start();