DBLayer:
- Use ACE_Future and ACE_Future_Set for async SQL queries with callback * Callbacks will now be executed from the thread and object that scheduled the request, instead of the world runnable thread (and thus are no longer dependent on the 50ms forced sleep time). * This design gets rid of a potential DOS loophole in the resultqueue system - unique requests will be cancelled when re-requested. - Drop now redundant SQLQueryTask, SQLResultQueue, SQLResultQueueTask operations. - Drop now redundant CharacterHandler class - Change static callback functions in WorldSession to normal functions. Thanks to Derex and Zor for advice along the way. --HG-- branch : trunk
This commit is contained in:
@@ -197,6 +197,32 @@ void DatabaseWorkerPool::CommitTransaction()
|
||||
}
|
||||
}
|
||||
|
||||
QueryResultFuture DatabaseWorkerPool::AsyncQuery(const char* sql)
|
||||
{
|
||||
QueryResultFuture res;
|
||||
BasicStatementTask* task = new BasicStatementTask(sql, res);
|
||||
Enqueue(task);
|
||||
return res; //! Fool compiler, has no use yet
|
||||
}
|
||||
|
||||
QueryResultFuture DatabaseWorkerPool::AsyncPQuery(const char* sql, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char szQuery[MAX_QUERY_LEN];
|
||||
va_start(ap, sql);
|
||||
int res = vsnprintf(szQuery, MAX_QUERY_LEN, sql, ap);
|
||||
va_end(ap);
|
||||
|
||||
return AsyncQuery(szQuery);
|
||||
}
|
||||
|
||||
QueryResultHolderFuture DatabaseWorkerPool::DelayQueryHolder(SQLQueryHolder* holder)
|
||||
{
|
||||
QueryResultHolderFuture res;
|
||||
SQLQueryHolderTask* task = new SQLQueryHolderTask(holder, res);
|
||||
Enqueue(task);
|
||||
return res; //! Fool compiler, has no use yet
|
||||
}
|
||||
|
||||
MySQLConnection* DatabaseWorkerPool::GetConnection()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user