diff --git a/source/cAuthenticator.cpp b/source/cAuthenticator.cpp index 9e176e0c5..c82b8cec0 100644 --- a/source/cAuthenticator.cpp +++ b/source/cAuthenticator.cpp @@ -37,9 +37,7 @@ cAuthenticator::cAuthenticator(void) : cAuthenticator::~cAuthenticator() { - mShouldTerminate = true; - mQueueNonempty.Set(); - Wait(); + Stop(); } @@ -102,6 +100,17 @@ void cAuthenticator::Authenticate(const AString & iUserName, const AString & iSe +void cAuthenticator::Stop(void) +{ + mShouldTerminate = true; + mQueueNonempty.Set(); + Wait(); +} + + + + + void cAuthenticator::Execute(void) { while (true) diff --git a/source/cAuthenticator.h b/source/cAuthenticator.h index cb2a4ff1e..dd4c5d989 100644 --- a/source/cAuthenticator.h +++ b/source/cAuthenticator.h @@ -41,6 +41,9 @@ public: /// Queues a request for authenticating a user. If the auth fails, the user is kicked void Authenticate(const AString & iUserName, const AString & iServerHash); + + // Stops the authenticator thread + void Stop(void); private: diff --git a/source/cRoot.cpp b/source/cRoot.cpp index bea466092..6fa467e93 100644 --- a/source/cRoot.cpp +++ b/source/cRoot.cpp @@ -139,6 +139,7 @@ void cRoot::Start() // Deallocate stuffs m_Server->Shutdown(); // This waits for threads to stop and d/c clients + m_Authenticator.Stop(); delete m_PluginManager; m_PluginManager = 0; // This should be first delete m_MonsterConfig; m_MonsterConfig = 0; if( m_WebAdmin ) { delete m_WebAdmin; m_WebAdmin = 0; }