aboutsummaryrefslogtreecommitdiff
path: root/src/server/bnetserver/Server/SessionManager.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2016-03-28 17:12:57 +0200
committerShauren <shauren.trinity@gmail.com>2016-03-28 17:12:57 +0200
commitdde620c402daf4ea8d132fb72a77eabc22f7a6d0 (patch)
tree7c12161d7a22915736b0c9a106de896eeb283399 /src/server/bnetserver/Server/SessionManager.cpp
parent619669c6209441fc2fb5b483d553badee8c30ad5 (diff)
Core: Updated to 6.2.4
* Rewrite bnetserver for new authentication protocol
Diffstat (limited to 'src/server/bnetserver/Server/SessionManager.cpp')
-rw-r--r--src/server/bnetserver/Server/SessionManager.cpp39
1 files changed, 3 insertions, 36 deletions
diff --git a/src/server/bnetserver/Server/SessionManager.cpp b/src/server/bnetserver/Server/SessionManager.cpp
index ed36a3630e1..1920496ffff 100644
--- a/src/server/bnetserver/Server/SessionManager.cpp
+++ b/src/server/bnetserver/Server/SessionManager.cpp
@@ -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;
}