From 7a26fbe4712efd2d1f41fd6c588e483d3db0ba1b Mon Sep 17 00:00:00 2001 From: faketruth Date: Wed, 15 Feb 2012 21:47:21 +0000 Subject: Can use the 'restart' command again. cAuthenticator no longer asserts because it properly stops when the server is stopped. git-svn-id: http://mc-server.googlecode.com/svn/trunk@266 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cAuthenticator.cpp | 15 ++++++++++++--- source/cAuthenticator.h | 3 +++ source/cRoot.cpp | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'source') 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; } -- cgit v1.2.3