summaryrefslogtreecommitdiffstats
path: root/src/Root.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2015-02-06 21:52:14 +0100
committerHowaner <franzi.moos@googlemail.com>2015-02-06 21:52:14 +0100
commit2c7925f0adc17d7680ff9791832ab2c349c2301f (patch)
treeef6233b0d9dece6f7520996f2a4d850470e2c2d3 /src/Root.cpp
parentReadded old DistributeStackToAreas() comment. (diff)
parentSwitched LuaState to use sizeof... (diff)
downloadcuberite-2c7925f0adc17d7680ff9791832ab2c349c2301f.tar
cuberite-2c7925f0adc17d7680ff9791832ab2c349c2301f.tar.gz
cuberite-2c7925f0adc17d7680ff9791832ab2c349c2301f.tar.bz2
cuberite-2c7925f0adc17d7680ff9791832ab2c349c2301f.tar.lz
cuberite-2c7925f0adc17d7680ff9791832ab2c349c2301f.tar.xz
cuberite-2c7925f0adc17d7680ff9791832ab2c349c2301f.tar.zst
cuberite-2c7925f0adc17d7680ff9791832ab2c349c2301f.zip
Diffstat (limited to 'src/Root.cpp')
-rw-r--r--src/Root.cpp64
1 files changed, 35 insertions, 29 deletions
diff --git a/src/Root.cpp b/src/Root.cpp
index eaacf3608..27d87c717 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -181,43 +181,49 @@ void cRoot::Start(void)
IniFile.WriteFile("settings.ini");
LOGD("Finalising startup...");
- m_Server->Start();
-
- m_WebAdmin->Start();
-
- #if !defined(ANDROID_NDK)
- LOGD("Starting InputThread...");
- try
+ if (m_Server->Start())
{
- m_InputThread = std::thread(InputThread, std::ref(*this));
- m_InputThread.detach();
- }
- catch (std::system_error & a_Exception)
- {
- LOGERROR("cRoot::Start (std::thread) error %i: could not construct input thread; %s", a_Exception.code().value(), a_Exception.what());
- }
- #endif
+ m_WebAdmin->Start();
- LOG("Startup complete, took %ldms!", static_cast<long int>(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - BeginTime).count()));
- #ifdef _WIN32
- EnableMenuItem(hmenu, SC_CLOSE, MF_ENABLED); // Re-enable close button
- #endif
+ #if !defined(ANDROID_NDK)
+ LOGD("Starting InputThread...");
+ try
+ {
+ m_InputThread = std::thread(InputThread, std::ref(*this));
+ m_InputThread.detach();
+ }
+ catch (std::system_error & a_Exception)
+ {
+ LOGERROR("cRoot::Start (std::thread) error %i: could not construct input thread; %s", a_Exception.code().value(), a_Exception.what());
+ }
+ #endif
- while (!m_bStop && !m_bRestart && !m_TerminateEventRaised) // These are modified by external threads
- {
- std::this_thread::sleep_for(std::chrono::seconds(1));
- }
+ LOG("Startup complete, took %ldms!", static_cast<long int>(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - BeginTime).count()));
+ #ifdef _WIN32
+ EnableMenuItem(hmenu, SC_CLOSE, MF_ENABLED); // Re-enable close button
+ #endif
- if (m_TerminateEventRaised)
+ while (!m_bStop && !m_bRestart && !m_TerminateEventRaised) // These are modified by external threads
+ {
+ std::this_thread::sleep_for(std::chrono::seconds(1));
+ }
+
+ if (m_TerminateEventRaised)
+ {
+ m_bStop = true;
+ }
+
+ // Stop the server:
+ m_WebAdmin->Stop();
+
+ LOG("Shutting down server...");
+ m_Server->Shutdown();
+ } // if (m_Server->Start())
+ else
{
m_bStop = true;
}
- // Stop the server:
- m_WebAdmin->Stop();
-
- LOG("Shutting down server...");
- m_Server->Shutdown();
delete m_MojangAPI; m_MojangAPI = nullptr;
LOGD("Shutting down deadlock detector...");