From e2a8dfffbec626186f6b93894aec1353774ed99b Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Sun, 19 Dec 2010 15:48:55 +0100 Subject: Core/DBLayer: - Add generic HandleMySQLErrno() method. - Add the ability to re-execute a certain statement if errorhandler resolved the situation succesfuly. - Add support for MySQL errno´s 2006, 2013, 2048, 2055 - fixes automatic reconnection behaviour. - Cleanup in affected code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NOTE: You should still be smart enough to configure your worldserver and authserver´s MaxPingTime to be lower than your MySQL´s wait_time. --HG-- branch : trunk --- src/server/shared/Database/MySQLConnection.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/server/shared/Database/MySQLConnection.h') diff --git a/src/server/shared/Database/MySQLConnection.h b/src/server/shared/Database/MySQLConnection.h index 847e3a84633..11e94c7844e 100755 --- a/src/server/shared/Database/MySQLConnection.h +++ b/src/server/shared/Database/MySQLConnection.h @@ -16,6 +16,7 @@ */ #include + #include "DatabaseWorkerPool.h" #include "Util.h" @@ -88,11 +89,6 @@ class MySQLConnection void Ping() { mysql_ping(m_Mysql); } protected: - MYSQL* GetHandle() { return m_Mysql; } - MySQLPreparedStatement* GetPreparedStatement(uint32 index); - void PrepareStatement(uint32 index, const char* sql, bool async = false); - std::vector m_stmts; //! PreparedStatements storage - bool LockIfReady() { /// Tries to acquire lock. If lock is acquired by another thread @@ -106,6 +102,17 @@ class MySQLConnection m_Mutex.release(); } + MYSQL* GetHandle() { return m_Mysql; } + MySQLPreparedStatement* GetPreparedStatement(uint32 index); + void PrepareStatement(uint32 index, const char* sql, bool async = false); + + protected: + std::vector m_stmts; //! PreparedStatements storage + bool m_reconnecting; //! Are we reconnecting? + + private: + bool _HandleMySQLErrno(uint32 errNo); + private: ACE_Activation_Queue* m_queue; //! Queue shared with other asynchroneous connections. DatabaseWorker* m_worker; //! Core worker task. -- cgit v1.2.3