summaryrefslogtreecommitdiff
path: root/src/common/Database/DatabaseWorkerPool.cpp
diff options
context:
space:
mode:
authorKargatum <dowlandtop@yandex.com>2020-09-12 03:50:48 +0700
committerGitHub <noreply@github.com>2020-09-12 03:50:48 +0700
commit3a0b0356ac2314d6e83ec9b52cddcfb15bf0da8a (patch)
tree916c49701ec8dc4bdb59ed0e5722740107df2d3d /src/common/Database/DatabaseWorkerPool.cpp
parente15a4939275e14b4d8ee2df94049edb34d57954e (diff)
refactor(Core/Common): restyle common lib with astyle (#3461)
Diffstat (limited to 'src/common/Database/DatabaseWorkerPool.cpp')
-rw-r--r--src/common/Database/DatabaseWorkerPool.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/common/Database/DatabaseWorkerPool.cpp b/src/common/Database/DatabaseWorkerPool.cpp
index 53b79d7d37..b687895738 100644
--- a/src/common/Database/DatabaseWorkerPool.cpp
+++ b/src/common/Database/DatabaseWorkerPool.cpp
@@ -12,8 +12,8 @@
template <class T>
DatabaseWorkerPool<T>::DatabaseWorkerPool() :
-_mqueue(new ACE_Message_Queue<ACE_SYNCH>(2*1024*1024, 2*1024*1024)),
-_queue(new ACE_Activation_Queue(_mqueue))
+ _mqueue(new ACE_Message_Queue<ACE_SYNCH>(2 * 1024 * 1024, 2 * 1024 * 1024)),
+ _queue(new ACE_Activation_Queue(_mqueue))
{
memset(_connectionCount, 0, sizeof(_connectionCount));
_connections.resize(IDX_SIZE);
@@ -29,7 +29,7 @@ bool DatabaseWorkerPool<T>::Open(const std::string& infoString, uint8 async_thre
_connectionInfo = MySQLConnectionInfo(infoString);
sLog->outSQLDriver("Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.",
- GetDatabaseName(), async_threads, synch_threads);
+ GetDatabaseName(), async_threads, synch_threads);
//! Open asynchronous connections (delayed operations)
_connections[IDX_ASYNC].resize(async_threads);
@@ -39,7 +39,7 @@ bool DatabaseWorkerPool<T>::Open(const std::string& infoString, uint8 async_thre
res &= t->Open();
if (res) // only check mysql version if connection is valid
WPFatal(mysql_get_server_version(t->GetHandle()) >= MIN_MYSQL_SERVER_VERSION, "AzerothCore does not support MySQL versions below 5.6");
-
+
_connections[IDX_ASYNC][i] = t;
++_connectionCount[IDX_ASYNC];
}
@@ -56,11 +56,11 @@ bool DatabaseWorkerPool<T>::Open(const std::string& infoString, uint8 async_thre
if (res)
sLog->outSQLDriver("DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(),
- (_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC]));
+ (_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC]));
else
sLog->outError("DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile "
- "for specific errors.", GetDatabaseName());
-
+ "for specific errors.", GetDatabaseName());
+
return res;
}
@@ -84,7 +84,7 @@ void DatabaseWorkerPool<T>::Close()
}
sLog->outSQLDriver("Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.",
- GetDatabaseName());
+ GetDatabaseName());
//! Shut down the synchronous connections
//! There's no need for locking the connection, because DatabaseWorkerPool<>::Close
@@ -212,7 +212,7 @@ SQLTransaction DatabaseWorkerPool<T>::BeginTransaction()
template <class T>
void DatabaseWorkerPool<T>::CommitTransaction(SQLTransaction transaction)
{
- #ifdef ACORE_DEBUG
+#ifdef ACORE_DEBUG
//! Only analyze transaction weaknesses in Debug mode.
//! Ideally we catch the faults in Debug mode and then correct them,
//! so there's no need to waste these CPU cycles in Release mode.
@@ -227,7 +227,7 @@ void DatabaseWorkerPool<T>::CommitTransaction(SQLTransaction transaction)
default:
break;
}
- #endif // ACORE_DEBUG
+#endif // ACORE_DEBUG
Enqueue(new TransactionTask(transaction));
}
@@ -311,7 +311,7 @@ T* DatabaseWorkerPool<T>::GetFreeConnection()
uint8 i = 0;
size_t num_cons = _connectionCount[IDX_SYNCH];
T* t = nullptr;
-
+
//! Block forever until a connection is free
for (;;)
{