summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-15 22:47:21 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-15 22:47:21 +0100
commit7a26fbe4712efd2d1f41fd6c588e483d3db0ba1b (patch)
treeaaeec8b2a6d0ce2a02d089e53505b5b6d054f812
parentFixed a deadlock in WorldStorage (diff)
downloadcuberite-7a26fbe4712efd2d1f41fd6c588e483d3db0ba1b.tar
cuberite-7a26fbe4712efd2d1f41fd6c588e483d3db0ba1b.tar.gz
cuberite-7a26fbe4712efd2d1f41fd6c588e483d3db0ba1b.tar.bz2
cuberite-7a26fbe4712efd2d1f41fd6c588e483d3db0ba1b.tar.lz
cuberite-7a26fbe4712efd2d1f41fd6c588e483d3db0ba1b.tar.xz
cuberite-7a26fbe4712efd2d1f41fd6c588e483d3db0ba1b.tar.zst
cuberite-7a26fbe4712efd2d1f41fd6c588e483d3db0ba1b.zip
-rw-r--r--source/cAuthenticator.cpp15
-rw-r--r--source/cAuthenticator.h3
-rw-r--r--source/cRoot.cpp1
3 files changed, 16 insertions, 3 deletions
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; }