Fixed: crash when starting a new game after disconnecting from own server

This commit is contained in:
geckosoft
2010-11-01 03:46:38 +01:00
parent 2fb72155eb
commit 56598ce2ff
2 changed files with 16 additions and 1 deletions

View File

@@ -50,6 +50,18 @@ namespace OpenRA.Server
static ModData ModData;
static Map Map;
public static void StopListening()
{
conns.Clear();
GameStarted = false;
try
{
listener.Stop();
}catch(Exception)
{
}
}
public static void ServerMain(ModData modData, Settings settings, string map)
{
Log.AddChannel("server", "server.log");
@@ -98,7 +110,7 @@ namespace OpenRA.Server
foreach( Socket s in checkRead )
if( s == listener.Server ) AcceptConnection();
else conns.Single( c => c.socket == s ).ReadData();
else if (conns.Count > 0) conns.Single( c => c.socket == s ).ReadData();
if (Environment.TickCount - lastPing > MasterPingInterval * 1000)
PingMasterServer();