Core/DBLayer:

- Make time format of MaxPingTime consistent between authserver and worldserver. Note that the value is in minutes, update your config files accordingly if needed.
- Remove obsolete atomic uint32 and prevent concurrent calls to vector::size() in DatabaseWorkerPool

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-12-05 16:48:47 +01:00
parent 82ccfa9830
commit b845b9d0fd
4 changed files with 13 additions and 17 deletions
+3 -3
View File
@@ -40,10 +40,10 @@ LogsDir = ""
#
# MaxPingTime
# Description: Time (in seconds) between database pings.
# Default: 1800 - (30 minutes)
# Description: Time (in minutes) between database pings.
# Default: 30 - (minutes)
MaxPingTime = 1800
MaxPingTime = 30
#
# RealmServerPort
+2 -2
View File
@@ -1185,7 +1185,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_AUTOBROADCAST_INTERVAL] = sConfig.GetIntDefault("AutoBroadcast.Timer", 60000);
// MySQL ping time interval
m_int_configs[CONFIG_DB_PING_INTERVAL] = sConfig.GetIntDefault("MaxPingTime", 1800);
m_int_configs[CONFIG_DB_PING_INTERVAL] = sConfig.GetIntDefault("MaxPingTime", 30);
sScriptMgr.OnConfigLoad(reload);
}
@@ -1650,7 +1650,7 @@ void World::SetInitialWorldSettings()
m_timers[WUPDATE_AUTOBROADCAST].SetInterval(getIntConfig(CONFIG_AUTOBROADCAST_INTERVAL));
m_timers[WUPDATE_DELETECHARS].SetInterval(DAY*IN_MILLISECONDS); // check for chars to delete every day
m_timers[WUPDATE_PINGDB].SetInterval(getIntConfig(CONFIG_DB_PING_INTERVAL)*IN_MILLISECONDS); // Mysql ping time in seconds
m_timers[WUPDATE_PINGDB].SetInterval(getIntConfig(CONFIG_DB_PING_INTERVAL)*MINUTE*IN_MILLISECONDS); // Mysql ping time in minutes
//to set mailtimer to return mails every day between 4 and 5 am
//mailtimer is increased when updating auctions
@@ -18,7 +18,6 @@
#ifndef _DATABASEWORKERPOOL_H
#define _DATABASEWORKERPOOL_H
#include <ace/Atomic_Op_T.h>
#include <ace/Thread_Mutex.h>
#include "Common.h"
@@ -53,9 +52,6 @@ class DatabaseWorkerPool
{
template <class Y> friend class DatabaseWorker;
private:
typedef ACE_Atomic_Op<ACE_SYNCH_MUTEX, uint32> AtomicUInt;
public:
DatabaseWorkerPool() :
m_queue(new ACE_Activation_Queue(new ACE_Message_Queue<ACE_MT_SYNCH>)),
@@ -90,7 +86,7 @@ class DatabaseWorkerPool
for (uint8 i = 0; i < delaythreads; ++i)
m_delaythreads[i] = new DatabaseWorker<ThisClass>(m_queue, this);
sLog.outSQLDriver("Databasepool opened succesfuly. %u connections running.", (uint32)m_connectionCount.value());
sLog.outSQLDriver("Databasepool opened succesfuly. %u connections running.", m_connectionCount);
return true;
}
@@ -105,7 +101,7 @@ class DatabaseWorkerPool
m_delaythreads[i]->wait();
/// Shut down the connections
for (uint8 i = 0; i < m_connections.size(); ++i)
for (uint8 i = 0; i < m_connectionCount; ++i)
{
T* t = m_connections[i];
while (1)
@@ -302,7 +298,7 @@ class DatabaseWorkerPool
void KeepAlive()
{
/// Ping connections
for (uint8 i = 0; i < m_connections.size(); ++i)
for (uint8 i = 0; i < m_connectionCount; ++i)
{
T* t = m_connections[i];
if (t->LockIfReady())
@@ -319,7 +315,7 @@ class DatabaseWorkerPool
uint8 i = 0;
for (;;) /// Block forever until a connection is free
{
T* t = m_connections[++i % m_connectionCount.value()];
T* t = m_connections[++i % m_connectionCount];
if (t->LockIfReady()) /// Must be matched with t->Unlock() or you will get deadlocks
return t;
}
@@ -350,7 +346,7 @@ class DatabaseWorkerPool
ACE_Activation_Queue* m_queue; //! Queue shared by async worker threads.
std::vector<T*> m_connections;
AtomicUInt m_connectionCount; //! Counter of MySQL connections;
uint8 m_connectionCount; //! Counter of MySQL connections;
MySQLConnectionInfo m_connectionInfo;
std::vector<DatabaseWorker<ThisClass>*> m_delaythreads; //! Delaythreads (templatized)
};
+3 -3
View File
@@ -118,10 +118,10 @@ CharacterDatabase.Connections = 2
#
# MaxPingTime
# Description: Time (in seconds) between database pings.
# Default: 1800 - (30 minutes)
# Description: Time (in minutes) between database pings.
# Default: 30 - (minutes)
MaxPingTime = 1800
MaxPingTime = 30
#
# WorldServerPort