mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/Auth: Use QueryCallbackProcessor insted boost::optional. Fixes build for boost 1.55.0
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "Log.h"
|
||||
#include "AuthCodes.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "QueryCallback.h"
|
||||
#include "SHA1.h"
|
||||
#include "TOTP.h"
|
||||
#include "openssl/crypto.h"
|
||||
@@ -169,7 +170,7 @@ void AuthSession::Start()
|
||||
stmt->setString(0, ip_address);
|
||||
stmt->setUInt32(1, inet_addr(ip_address.c_str()));
|
||||
|
||||
_queryCallback = std::move(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&AuthSession::CheckIpCallback, this, std::placeholders::_1)));
|
||||
_queryProcessor.AddQuery(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&AuthSession::CheckIpCallback, this, std::placeholders::_1)));
|
||||
}
|
||||
|
||||
bool AuthSession::Update()
|
||||
@@ -177,8 +178,7 @@ bool AuthSession::Update()
|
||||
if (!AuthSocket::Update())
|
||||
return false;
|
||||
|
||||
if (_queryCallback && _queryCallback->InvokeIfReady() == QueryCallback::Completed)
|
||||
_queryCallback = boost::none;
|
||||
_queryProcessor.ProcessReadyQueries();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -288,18 +288,6 @@ bool AuthSession::HandleLogonChallenge()
|
||||
std::string login((const char*)challenge->I, challenge->I_len);
|
||||
TC_LOG_DEBUG("server.authserver", "[AuthChallenge] '%s'", login.c_str());
|
||||
|
||||
if (_queryCallback)
|
||||
{
|
||||
ByteBuffer pkt;
|
||||
pkt << uint8(AUTH_LOGON_CHALLENGE);
|
||||
pkt << uint8(0x00);
|
||||
pkt << uint8(WOW_FAIL_DB_BUSY);
|
||||
SendPacket(pkt);
|
||||
|
||||
TC_LOG_DEBUG("server.authserver", "[AuthChallenge] %s attempted to log too quick after previous attempt!", login.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
_build = challenge->build;
|
||||
_expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG));
|
||||
std::array<char, 5> os;
|
||||
@@ -318,7 +306,7 @@ bool AuthSession::HandleLogonChallenge()
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGONCHALLENGE);
|
||||
stmt->setString(0, login);
|
||||
|
||||
_queryCallback = std::move(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&AuthSession::LogonChallengeCallback, this, std::placeholders::_1)));
|
||||
_queryProcessor.AddQuery(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&AuthSession::LogonChallengeCallback, this, std::placeholders::_1)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -704,17 +692,6 @@ bool AuthSession::HandleReconnectChallenge()
|
||||
std::string login((const char*)challenge->I, challenge->I_len);
|
||||
TC_LOG_DEBUG("server.authserver", "[ReconnectChallenge] '%s'", login.c_str());
|
||||
|
||||
if (_queryCallback)
|
||||
{
|
||||
ByteBuffer pkt;
|
||||
pkt << uint8(AUTH_RECONNECT_CHALLENGE);
|
||||
pkt << uint8(WOW_FAIL_DB_BUSY);
|
||||
SendPacket(pkt);
|
||||
|
||||
TC_LOG_DEBUG("server.authserver", "[ReconnectChallenge] %s attempted to log too quick after previous attempt!", login.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
_build = challenge->build;
|
||||
_expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG));
|
||||
std::array<char, 5> os;
|
||||
@@ -733,7 +710,7 @@ bool AuthSession::HandleReconnectChallenge()
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_RECONNECTCHALLENGE);
|
||||
stmt->setString(0, login);
|
||||
|
||||
_queryCallback = std::move(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&AuthSession::ReconnectChallengeCallback, this, std::placeholders::_1)));
|
||||
_queryProcessor.AddQuery(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&AuthSession::ReconnectChallengeCallback, this, std::placeholders::_1)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -805,16 +782,10 @@ bool AuthSession::HandleRealmList()
|
||||
{
|
||||
TC_LOG_DEBUG("server.authserver", "Entering _HandleRealmList");
|
||||
|
||||
if (_queryCallback)
|
||||
{
|
||||
TC_LOG_DEBUG("server.authserver", "[RealmList] %s attempted to get realmlist too quick after previous attempt!", _accountInfo.Login.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALM_CHARACTER_COUNTS);
|
||||
stmt->setUInt32(0, _accountInfo.Id);
|
||||
|
||||
_queryCallback = std::move(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&AuthSession::RealmListCallback, this, std::placeholders::_1)));
|
||||
_queryProcessor.AddQuery(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&AuthSession::RealmListCallback, this, std::placeholders::_1)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user