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
This commit is contained in:
madmaxoft@gmail.com
2013-03-04 21:13:08 +00:00
parent 7e16d48855
commit 28d8d8419a
9 changed files with 360 additions and 123 deletions
+10 -11
View File
@@ -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...");