aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Database
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/shared/Database')
-rw-r--r--src/server/shared/Database/DatabaseWorker.cpp7
-rwxr-xr-xsrc/server/shared/Database/DatabaseWorkerPool.h3
-rwxr-xr-xsrc/server/shared/Database/MySQLConnection.cpp4
3 files changed, 3 insertions, 11 deletions
diff --git a/src/server/shared/Database/DatabaseWorker.cpp b/src/server/shared/Database/DatabaseWorker.cpp
index 8dc9ab4669d..662c879ad5e 100644
--- a/src/server/shared/Database/DatabaseWorker.cpp
+++ b/src/server/shared/Database/DatabaseWorker.cpp
@@ -34,11 +34,6 @@ int DatabaseWorker::svc()
if (!m_queue)
return -1;
- //! Since this is called from the worker thread itself, we can ensure
- //! that thread-specific variables remain in this thread.
- if (!m_conn->Open())
- return -1;
-
SQLOperation *request = NULL;
while (1)
{
@@ -52,7 +47,5 @@ int DatabaseWorker::svc()
delete request;
}
- //! Clean up thread-specific variables
- m_conn->Close();
return 0;
}
diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h
index cd855852867..aef952fab55 100755
--- a/src/server/shared/Database/DatabaseWorkerPool.h
+++ b/src/server/shared/Database/DatabaseWorkerPool.h
@@ -77,6 +77,7 @@ class DatabaseWorkerPool
for (uint8 i = 0; i < async_threads; ++i)
{
T* t = new T(m_queue, m_connectionInfo);
+ res &= t->Open();
m_connections[IDX_ASYNC][i] = t;
++m_connectionCount[IDX_ASYNC];
}
@@ -110,6 +111,7 @@ class DatabaseWorkerPool
DatabaseWorker* worker = t->m_worker;
worker->wait();
delete worker;
+ t->Close();
}
sLog->outSQLDriver("Asynchronous connections on databasepool '%s' terminated. Proceeding with synchronous connections.", m_connectionInfo.database.c_str());
@@ -124,6 +126,7 @@ class DatabaseWorkerPool
}
delete m_queue;
+
sLog->outSQLDriver("All connections on databasepool %s closed.", m_connectionInfo.database.c_str());
}
diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp
index 273d2842505..f686db4c199 100755
--- a/src/server/shared/Database/MySQLConnection.cpp
+++ b/src/server/shared/Database/MySQLConnection.cpp
@@ -68,13 +68,9 @@ MySQLConnection::~MySQLConnection()
}
mysql_close(m_Mysql);
- MySQL::Thread_End();
Unlock(); /// Unlock while we die, how ironic
}
-//! Can be called synchronously in DatabaseWorkerPool, in which thread-specific variables initialized in the main thread
-//! are deallocated.
-//! Can also be called by worker threads, in which their respective thread-specific variables are deallocated.
void MySQLConnection::Close()
{
/// Only close us if we're not operating