Fix server shutdown crash under mono.
This commit is contained in:
@@ -38,15 +38,10 @@ namespace OpenRA.Server
|
|||||||
public ModData ModData;
|
public ModData ModData;
|
||||||
public Map Map;
|
public Map Map;
|
||||||
|
|
||||||
|
bool shutdown = false;
|
||||||
public void Shutdown()
|
public void Shutdown()
|
||||||
{
|
{
|
||||||
conns.Clear();
|
shutdown = true;
|
||||||
GameStarted = false;
|
|
||||||
foreach (var t in ServerTraits.WithInterface<INotifyServerShutdown>())
|
|
||||||
t.ServerShutdown(this);
|
|
||||||
|
|
||||||
try { listener.Stop(); }
|
|
||||||
catch { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Server(ModData modData, Settings settings, string map)
|
public Server(ModData modData, Settings settings, string map)
|
||||||
@@ -103,13 +98,17 @@ namespace OpenRA.Server
|
|||||||
foreach (var t in ServerTraits.WithInterface<ITick>())
|
foreach (var t in ServerTraits.WithInterface<ITick>())
|
||||||
t.Tick(this);
|
t.Tick(this);
|
||||||
|
|
||||||
if (conns.Count() == 0)
|
if (conns.Count() == 0 || shutdown)
|
||||||
{
|
|
||||||
listener.Stop();
|
|
||||||
GameStarted = false;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameStarted = false;
|
||||||
|
foreach (var t in ServerTraits.WithInterface<INotifyServerShutdown>())
|
||||||
|
t.ServerShutdown(this);
|
||||||
|
|
||||||
|
conns.Clear();
|
||||||
|
try { listener.Stop(); }
|
||||||
|
catch { }
|
||||||
} ) { IsBackground = true }.Start();
|
} ) { IsBackground = true }.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user