mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Allow the server to shutdown before the main loop has started
This commit is contained in:
@@ -127,7 +127,7 @@ namespace Robust.Server
|
||||
|
||||
_shutdownReason = reason;
|
||||
|
||||
_mainLoop.Running = false;
|
||||
if (_mainLoop != null) _mainLoop.Running = false;
|
||||
if (_logHandler != null)
|
||||
{
|
||||
_log.RootSawmill.RemoveHandler(_logHandler);
|
||||
@@ -506,7 +506,13 @@ namespace Robust.Server
|
||||
{
|
||||
SetupMainLoop();
|
||||
|
||||
_mainLoop.Run();
|
||||
// If the server has been given a reason to shut down before the main loop has started,
|
||||
// Don't start the main loop. This only works if a reason is passed to Shutdown(...)
|
||||
if (_shutdownReason != null)
|
||||
{
|
||||
Logger.Fatal("Shutdown has been requested before the main loop has been started, complying.");
|
||||
}
|
||||
else _mainLoop.Run();
|
||||
|
||||
FinishMainLoop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user