From 69cdb67d7cd9e7680fe7675adf60ab3437cba268 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 5 Oct 2016 10:26:49 -0500 Subject: [PATCH] cleanup? neeed to investigate how best to close hanging open connections here or in udp lib, also a method to bypass service callbacks when blocking ddoses --- .../LoginServer/src/shared/LoginServer.cpp | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index d6525d55..df7e0cfd 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -14,7 +14,11 @@ #include "ConsoleManager.h" #include "CSToolConnection.h" #include "DatabaseConnection.h" + +#ifdef _DEBUG #include "LoginServerRemoteDebugSetup.h" +#endif + #include "MonAPI2/MonitorAPI.h" #include "PingConnection.h" #include "PurgeManager.h" @@ -250,21 +254,14 @@ ClientConnection* LoginServer::getUnvalidatedClient(int clientId) void LoginServer::removeClient(int clientId) { - if (clientId) // yeah why bother if it's null? + std::map::iterator i = m_clientMap.find(clientId); + if (i != m_clientMap.end()) { - std::map::iterator i = m_clientMap.find(clientId); - if (i != m_clientMap.end()) + if (i->second->getIsValidated()) { - if (i->second->getIsValidated()) - { - IGNORE_RETURN(m_validatedClientMap.erase(i->second->getStationId())); - } - IGNORE_RETURN(m_clientMap.erase(clientId)); + IGNORE_RETURN(m_validatedClientMap.erase(i->second->getStationId())); } - } - else - { - DEBUG_WARNING(true, ("Tried to remove a client with client id == 0 (possibly DoS attack?)")); + IGNORE_RETURN(m_clientMap.erase(clientId)); } } @@ -1160,7 +1157,11 @@ void LoginServer::validateAccountForTransfer(const TransferRequestMoveValidation void LoginServer::run(void) { NetworkHandler::install(); + +#ifdef _DEBUG LoginServerRemoteDebugSetup::install(); +#endif + DatabaseConnection::getInstance().connect(); DatabaseConnection::getInstance().requestClusterList(); SetupSharedLog::install("LoginServer"); @@ -1246,7 +1247,10 @@ void LoginServer::run(void) ConsoleManager::remove(); DatabaseConnection::getInstance().disconnect(); + +#ifdef _DEBUG LoginServerRemoteDebugSetup::remove(); +#endif SetupSharedLog::remove(); NetworkHandler::remove();