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

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
This commit is contained in:
Machiavelli committed 2010-12-19 15:48:55 +01:00
1 parent 14a480cb13
commit e2a8dfffbe
5 files changed
+114 -38

No files matched your search

+12 -5
View File
@@ -16,6 +16,7 @@
*/
#include <ace/Activation_Queue.h>
#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<MySQLPreparedStatement*> 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<MySQLPreparedStatement*> 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.