Host closing server closes all connections and closes the listener.
This commit is contained in:
@@ -24,7 +24,7 @@ namespace OpenRA.Server
|
||||
static class Server
|
||||
{
|
||||
static List<Connection> conns = new List<Connection>();
|
||||
static TcpListener listener;
|
||||
static TcpListener listener = null;
|
||||
static Dictionary<int, List<Connection>> inFlightFrames
|
||||
= new Dictionary<int, List<Connection>>();
|
||||
static Session lobbyInfo;
|
||||
@@ -424,6 +424,14 @@ namespace OpenRA.Server
|
||||
if (conns.Count != 0)
|
||||
SyncLobbyInfo();
|
||||
}
|
||||
|
||||
public static void CloseServer()
|
||||
{
|
||||
while (conns.Count() != 0)
|
||||
DropClient(conns.ElementAt(conns.Count() - 1), null);
|
||||
if (listener != null)
|
||||
listener.Stop();
|
||||
}
|
||||
|
||||
static void SyncLobbyInfo()
|
||||
{
|
||||
|
||||
@@ -80,6 +80,8 @@ namespace OpenRA.Widgets.Delegates
|
||||
var disconnectButton = lobby.GetWidget("DISCONNECT_BUTTON");
|
||||
disconnectButton.OnMouseUp = mi =>
|
||||
{
|
||||
if (Game.IsHost)
|
||||
Server.Server.CloseServer();
|
||||
Game.Disconnect();
|
||||
return true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user