Stop server crashing if can't establish socket

This commit is contained in:
Alli
2010-02-07 01:32:42 +13:00
committed by Chris Forbes
parent cafebf749d
commit 31881edade

View File

@@ -34,9 +34,16 @@ namespace OpenRA.Server
foreach( var m in lobbyInfo.GlobalSettings.Mods )
Console.WriteLine("- {0}", m);
try
{
listener.Start();
Console.WriteLine("Server started.");
}
catch (Exception e)
{
Console.WriteLine("Server failed to start.");
Environment.Exit(1);
}
for (; ; )
{
@@ -56,6 +63,7 @@ namespace OpenRA.Server
foreach (var c in conns.Where(a => a.Stream != null).ToArray())
SendNextChunk(c);
}
}
static int ChooseFreePlayerIndex()
@@ -320,6 +328,9 @@ namespace OpenRA.Server
}
lobbyInfo.GlobalSettings.Map = s;
foreach(var client in lobbyInfo.Clients)
client.SpawnPoint = 0;
SyncLobbyInfo();
return true;
}},