From 28d8d8419a5b900e9d20ce91dc63e28349b6470a Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Mon, 4 Mar 2013 21:13:08 +0000 Subject: Moved client socket accepting into a separate thread object, cListenThread MCServer can now listen on multiple ports FS #312 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1252 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Root.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'source/Root.cpp') diff --git a/source/Root.cpp b/source/Root.cpp index 41788ff8d..ea33afe7e 100644 --- a/source/Root.cpp +++ b/source/Root.cpp @@ -163,28 +163,27 @@ void cRoot::Start(void) StartWorlds(); LOG("Starting server..."); - m_Server->StartListenThread(); - //cHeartBeat* HeartBeat = new cHeartBeat(); + m_Server->Start(); -#if !defined(ANDROID_NDK) + #if !defined(ANDROID_NDK) LOG("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 + 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."); - while( !m_bStop && !m_bRestart ) // These are modified by external threads + while (!m_bStop && !m_bRestart) // These are modified by external threads { - cSleep::MilliSleep( 1000 ); + cSleep::MilliSleep(1000); } -#if !defined(ANDROID_NDK) - delete m_InputThread; m_InputThread = 0; -#endif + #if !defined(ANDROID_NDK) + delete m_InputThread; m_InputThread = NULL; + #endif // Deallocate stuffs LOG("Shutting down server..."); - m_Server->Shutdown(); // This waits for threads to stop and d/c clients + m_Server->Shutdown(); // This waits for threads to stop and d/c clients LOG("Stopping world threads..."); StopWorlds(); LOG("Stopping authenticator..."); -- cgit v1.2.3