diff options
author | Mattes D <github@xoft.cz> | 2013-10-01 11:40:13 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2013-10-01 11:40:13 +0200 |
commit | ba8152608f1ce93ec3baf0a9f284448dfa9f5d69 (patch) | |
tree | 327fb6d1a087c913b757ba01ab5d6720c220f2f9 /source/Root.cpp | |
parent | Merge pull request #199 from tigerw/moar-bugfixes (diff) | |
parent | Removed unneeded statement (diff) | |
download | cuberite-ba8152608f1ce93ec3baf0a9f284448dfa9f5d69.tar cuberite-ba8152608f1ce93ec3baf0a9f284448dfa9f5d69.tar.gz cuberite-ba8152608f1ce93ec3baf0a9f284448dfa9f5d69.tar.bz2 cuberite-ba8152608f1ce93ec3baf0a9f284448dfa9f5d69.tar.lz cuberite-ba8152608f1ce93ec3baf0a9f284448dfa9f5d69.tar.xz cuberite-ba8152608f1ce93ec3baf0a9f284448dfa9f5d69.tar.zst cuberite-ba8152608f1ce93ec3baf0a9f284448dfa9f5d69.zip |
Diffstat (limited to 'source/Root.cpp')
-rw-r--r-- | source/Root.cpp | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/source/Root.cpp b/source/Root.cpp index 3933535f1..abe153b30 100644 --- a/source/Root.cpp +++ b/source/Root.cpp @@ -17,6 +17,7 @@ #include "Protocol/ProtocolRecognizer.h" // for protocol version constants #include "CommandOutput.h" #include "DeadlockDetect.h" +#include "OSSupport/Timer.h" #include "../iniFile/iniFile.h" @@ -91,6 +92,10 @@ void cRoot::InputThread(void * a_Params) void cRoot::Start(void) { + cTimer Time; + + long long mseconds = Time.GetNowTime(); + cDeadlockDetect dd; delete m_Log; m_Log = new cMCLogger(); @@ -125,7 +130,7 @@ void cRoot::Start(void) LOG("Starting server..."); if (!m_Server->InitServer(IniFile)) { - LOGERROR("Failed to start server, shutting down."); + LOGERROR("Failure starting server, aborting..."); return; } IniFile.WriteFile(); @@ -138,45 +143,49 @@ void cRoot::Start(void) if (WebIniFile.GetValueB("WebAdmin", "Enabled", false)) { - LOG("Creating WebAdmin..."); + LOGD("Creating WebAdmin..."); m_WebAdmin = new cWebAdmin(8080); } - LOG("Loading settings..."); + LOGD("Loading settings..."); m_GroupManager = new cGroupManager(); m_CraftingRecipes = new cCraftingRecipes; m_FurnaceRecipe = new cFurnaceRecipe(); - LOG("Loading worlds..."); + LOGD("Loading worlds..."); LoadWorlds(); - LOG("Loading plugin manager..."); + LOGD("Loading plugin manager..."); m_PluginManager = new cPluginManager(); m_PluginManager->ReloadPluginsNow(); - LOG("Loading MonsterConfig..."); + LOGD("Loading MonsterConfig..."); m_MonsterConfig = new cMonsterConfig; // This sets stuff in motion - LOG("Starting Authenticator..."); + LOGD("Starting Authenticator..."); m_Authenticator.Start(); - LOG("Starting worlds..."); + LOGD("Starting worlds..."); StartWorlds(); - LOG("Starting deadlock detector..."); + LOGD("Starting deadlock detector..."); dd.Start(); - LOG("Starting server..."); + LOGD("Finalising startup..."); m_Server->Start(); #if !defined(ANDROID_NDK) - LOG("Starting InputThread..."); + LOGD("Starting InputThread..."); m_InputThread = new cThread( InputThread, this, "cRoot::InputThread" ); m_InputThread->Start( false ); // We should NOT wait? Otherwise we canīt stop the server from other threads than the input thread #endif - LOG("Initialization done, server running now."); + long long finishmseconds = Time.GetNowTime(); + finishmseconds -= mseconds; + + LOG("Startup complete, took %i ms!", finishmseconds); + while (!m_bStop && !m_bRestart) // These are modified by external threads { cSleep::MilliSleep(1000); @@ -190,37 +199,37 @@ void cRoot::Start(void) LOG("Shutting down server..."); m_Server->Shutdown(); - LOG("Shutting down deadlock detector..."); + LOGD("Shutting down deadlock detector..."); dd.Stop(); - LOG("Stopping world threads..."); + LOGD("Stopping world threads..."); StopWorlds(); - LOG("Stopping authenticator..."); + LOGD("Stopping authenticator..."); m_Authenticator.Stop(); - LOG("Freeing MonsterConfig..."); + LOGD("Freeing MonsterConfig..."); delete m_MonsterConfig; m_MonsterConfig = NULL; - LOG("Stopping WebAdmin..."); + LOGD("Stopping WebAdmin..."); delete m_WebAdmin; m_WebAdmin = NULL; - LOG("Unloading recipes..."); + LOGD("Unloading recipes..."); delete m_FurnaceRecipe; m_FurnaceRecipe = NULL; delete m_CraftingRecipes; m_CraftingRecipes = NULL; - LOG("Forgetting groups..."); + LOGD("Forgetting groups..."); delete m_GroupManager; m_GroupManager = 0; - LOG("Unloading worlds..."); + LOGD("Unloading worlds..."); UnloadWorlds(); - LOG("Stopping plugin manager..."); + LOGD("Stopping plugin manager..."); delete m_PluginManager; m_PluginManager = NULL; cItemHandler::Deinit(); cBlockHandler::Deinit(); - LOG("Destroying server..."); + LOG("Cleaning up..."); //delete HeartBeat; HeartBeat = 0; delete m_Server; m_Server = 0; - LOG("Shutdown done."); + LOG("Shutdown successful!"); } delete m_Log; m_Log = 0; |