Core: Updated to 6.2.4

* Rewrite bnetserver for new authentication protocol
This commit is contained in:
Shauren
2016-03-28 17:12:57 +02:00
parent 619669c620
commit dde620c402
85 changed files with 9688 additions and 4976 deletions

View File

@@ -37,41 +37,8 @@ void Battlenet::SessionManager::OnSocketAccept(tcp::socket&& sock, uint32 thread
sSessionMgr.OnSocketOpen(std::forward<tcp::socket>(sock), threadIndex);
}
void Battlenet::SessionManager::AddSession(Session* session)
Battlenet::SessionManager& Battlenet::SessionManager::Instance()
{
std::unique_lock<boost::shared_mutex> lock(_sessionMutex);
_sessions[{ session->GetAccountId(), session->GetGameAccountId() }] = session;
_sessionsByAccountId[session->GetAccountId()].push_back(session);
}
void Battlenet::SessionManager::RemoveSession(Session* session)
{
std::unique_lock<boost::shared_mutex> lock(_sessionMutex);
auto itr = _sessions.find({ session->GetAccountId(), session->GetGameAccountId() });
// Remove old session only if it was not overwritten by reconnecting
if (itr != _sessions.end() && itr->second == session)
_sessions.erase(itr);
_sessionsByAccountId[session->GetAccountId()].remove(session);
}
Battlenet::Session* Battlenet::SessionManager::GetSession(uint32 accountId, uint32 gameAccountId) const
{
boost::shared_lock<boost::shared_mutex> lock(_sessionMutex);
auto itr = _sessions.find({ accountId, gameAccountId });
if (itr != _sessions.end())
return itr->second;
return nullptr;
}
std::list<Battlenet::Session*> Battlenet::SessionManager::GetSessions(uint32 accountId) const
{
boost::shared_lock<boost::shared_mutex> lock(_sessionMutex);
std::list<Session*> sessions;
auto itr = _sessionsByAccountId.find(accountId);
if (itr != _sessionsByAccountId.end())
sessions = itr->second;
return sessions;
static SessionManager instance;
return instance;
}