aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/shared/Database/DatabaseWorkerPool.cpp9
-rw-r--r--src/server/shared/Database/MySQLConnection.cpp1
-rw-r--r--src/server/shared/Database/MySQLThreading.h4
3 files changed, 11 insertions, 3 deletions
diff --git a/src/server/shared/Database/DatabaseWorkerPool.cpp b/src/server/shared/Database/DatabaseWorkerPool.cpp
index 87289e0a19b..cbccf529c75 100644
--- a/src/server/shared/Database/DatabaseWorkerPool.cpp
+++ b/src/server/shared/Database/DatabaseWorkerPool.cpp
@@ -59,6 +59,7 @@ bool DatabaseWorkerPool::Open(const std::string& infoString, uint8 num_threads)
void DatabaseWorkerPool::Close()
{
+ DEBUG_LOG("Closing down %u connections on this DatabaseWorkerPool", (uint32)m_connections.value());
/// Shuts down worker threads for this connection pool.
ACE_Thread_Mutex shutdown_Mtx;
ACE_Condition_Thread_Mutex m_condition(shutdown_Mtx);
@@ -66,15 +67,18 @@ void DatabaseWorkerPool::Close()
{
Enqueue(new DatabaseWorkerPoolEnd(m_condition));
m_condition.wait();
+ --m_connections;
}
m_queue->queue()->deactivate();
delete m_bundle_conn;
m_bundle_conn = NULL;
+ --m_connections;
+ DEBUG_LOG("Closed bundled connection.");
//- MySQL::Thread_End() should be called manually from the aborting calling threads
- DEBUG_LOG("Waiting for synchroneous database threads to exit.");
+ DEBUG_LOG("Waiting for %u synchroneous database threads to exit.", (uint32)m_connections.value());
while (!m_sync_connections.empty())
{
}
@@ -98,6 +102,8 @@ void DatabaseWorkerPool::Init_MySQL_Connection()
sLog.outDebug("Core thread with ID ["UI64FMTD"] initializing MySQL connection.",
(uint64)ACE_Based::Thread::currentId());
+
+ ++m_connections;
}
void DatabaseWorkerPool::End_MySQL_Connection()
@@ -111,6 +117,7 @@ void DatabaseWorkerPool::End_MySQL_Connection()
}
delete conn;
conn = NULL;
+ --m_connections;
}
void DatabaseWorkerPool::Execute(const char* sql)
diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp
index 3be6bf76a8c..ccb24935f81 100644
--- a/src/server/shared/Database/MySQLConnection.cpp
+++ b/src/server/shared/Database/MySQLConnection.cpp
@@ -40,6 +40,7 @@ m_Mysql(NULL)
MySQLConnection::~MySQLConnection()
{
+ MySQL::Thread_End();
mysql_close(m_Mysql);
}
diff --git a/src/server/shared/Database/MySQLThreading.h b/src/server/shared/Database/MySQLThreading.h
index 3c039a4d165..5671d3b2836 100644
--- a/src/server/shared/Database/MySQLThreading.h
+++ b/src/server/shared/Database/MySQLThreading.h
@@ -34,7 +34,7 @@ class MySQL
static void Thread_Init()
{
mysql_thread_init();
- printf("Core thread with ID ["UI64FMTD"] initializing MySQL thread.",
+ printf("Core thread with ID ["UI64FMTD"] initializing MySQL thread.\n",
(uint64)ACE_Based::Thread::currentId());
}
@@ -45,7 +45,7 @@ class MySQL
static void Thread_End()
{
mysql_thread_end();
- printf("Core thread with ID ["UI64FMTD"] shutting down MySQL thread.",
+ printf("Core thread with ID ["UI64FMTD"] shutting down MySQL thread.\n",
(uint64)ACE_Based::Thread::currentId());
}
};