Dispose all connections when shutting down a server

This commit is contained in:
abcdefg30
2022-10-23 21:28:05 +02:00
committed by teinarss
parent 111d9e4230
commit a00348dac1

View File

@@ -49,7 +49,7 @@ namespace OpenRA.Server
public readonly MersenneTwister Random = new MersenneTwister();
public readonly ServerType Type;
public List<Connection> Conns = new List<Connection>();
public readonly List<Connection> Conns = new List<Connection>();
public Session LobbyInfo;
public ServerSettings Settings;
@@ -392,6 +392,10 @@ namespace OpenRA.Server
foreach (var t in serverTraits.WithInterface<INotifyServerShutdown>())
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();