mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[11059] Fix crash in [11054]. As it turned out - we use not only async transactions but async queries too during server startup =/
Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
parent
24164ef020
commit
d67219e327
5 changed files with 17 additions and 10 deletions
|
|
@ -199,9 +199,9 @@ int Master::Run()
|
|||
|
||||
//server loaded successfully => enable async DB requests
|
||||
//this is done to forbid any async transactions during server startup!
|
||||
CharacterDatabase.InitDelayThread();
|
||||
WorldDatabase.InitDelayThread();
|
||||
LoginDatabase.InitDelayThread();
|
||||
CharacterDatabase.AllowAsyncTransactions();
|
||||
WorldDatabase.AllowAsyncTransactions();
|
||||
LoginDatabase.AllowAsyncTransactions();
|
||||
|
||||
///- Catch termination signals
|
||||
_HookSignals();
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ extern int main(int argc, char **argv)
|
|||
#endif
|
||||
|
||||
//server has started up successfully => enable async DB requests
|
||||
LoginDatabase.InitDelayThread();
|
||||
LoginDatabase.AllowAsyncTransactions();
|
||||
|
||||
// maximum counter for next ping
|
||||
uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / 100000));
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ bool Database::Initialize(const char * infoString, int nConns /*= 1*/)
|
|||
return false;
|
||||
|
||||
m_pResultQueue = new SqlResultQueue;
|
||||
|
||||
InitDelayThread();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -277,7 +279,7 @@ bool Database::Execute(const char *sql)
|
|||
else
|
||||
{
|
||||
//if async execution is not available
|
||||
if(!m_threadBody)
|
||||
if(!m_bAllowAsyncTransactions)
|
||||
return DirectExecute(sql);
|
||||
|
||||
// Simple sql statement
|
||||
|
|
@ -363,7 +365,7 @@ bool Database::CommitTransaction()
|
|||
return false;
|
||||
|
||||
//if async execution is not available
|
||||
if(!m_delayThread)
|
||||
if(!m_bAllowAsyncTransactions)
|
||||
return CommitTransactionDirect();
|
||||
|
||||
//add SqlTransaction to the async queue
|
||||
|
|
|
|||
|
|
@ -82,8 +82,6 @@ class MANGOS_DLL_SPEC Database
|
|||
|
||||
virtual bool Initialize(const char *infoString, int nConns = 1);
|
||||
//start worker thread for async DB request execution
|
||||
//you should call it explicitly after your server successfully started up
|
||||
//NO ASYNC TRANSACTIONS DURING SERVER STARTUP - ONLY DURING RUNTIME!!!
|
||||
virtual void InitDelayThread();
|
||||
//stop worker thread
|
||||
virtual void HaltDelayThread();
|
||||
|
|
@ -178,9 +176,14 @@ class MANGOS_DLL_SPEC Database
|
|||
//function to ping database connections
|
||||
void Ping();
|
||||
|
||||
//set this to allow async transactions
|
||||
//you should call it explicitly after your server successfully started up
|
||||
//NO ASYNC TRANSACTIONS DURING SERVER STARTUP - ONLY DURING RUNTIME!!!
|
||||
void AllowAsyncTransactions() { m_bAllowAsyncTransactions = true; }
|
||||
|
||||
protected:
|
||||
Database() : m_pAsyncConn(NULL), m_pResultQueue(NULL), m_threadBody(NULL), m_delayThread(NULL),
|
||||
m_logSQL(false), m_pingIntervallms(0), m_nQueryConnPoolSize(1)
|
||||
m_logSQL(false), m_pingIntervallms(0), m_nQueryConnPoolSize(1), m_bAllowAsyncTransactions(false)
|
||||
{
|
||||
m_nQueryCounter = -1;
|
||||
}
|
||||
|
|
@ -239,6 +242,8 @@ class MANGOS_DLL_SPEC Database
|
|||
SqlDelayThread * m_threadBody; ///< Pointer to delay sql executer (owned by m_delayThread)
|
||||
ACE_Based::Thread * m_delayThread; ///< Pointer to executer thread
|
||||
|
||||
bool m_bAllowAsyncTransactions; ///< flag which specifies if async transactions are enabled
|
||||
|
||||
private:
|
||||
|
||||
bool m_logSQL;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11058"
|
||||
#define REVISION_NR "11059"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue