From 7a48471d6dce89138baa87ff9445f31df316ce54 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 3 Oct 2016 00:13:50 -0500 Subject: [PATCH] cleanup on udplib if, and hopefully properly disconnect on unsuccessful logins to prevent blocking legit users - will have to test dossing after this --- .../LoginServer/src/shared/ClientConnection.cpp | 3 ++- external/3rd/library/udplibrary/UdpLibrary.cpp | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index e786793d..a15c47f7 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -251,7 +251,8 @@ void ClientConnection::validateClient(const std::string & id, const std::string LoginServer::getInstance().onValidateClient(suid, uname, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); } - // else this case will never be reached, noop + + disconnect(); // to remove from their connection count } // ---------------------------------------------------------------------------- diff --git a/external/3rd/library/udplibrary/UdpLibrary.cpp b/external/3rd/library/udplibrary/UdpLibrary.cpp index 54e07438..945b3bf4 100755 --- a/external/3rd/library/udplibrary/UdpLibrary.cpp +++ b/external/3rd/library/udplibrary/UdpLibrary.cpp @@ -1032,15 +1032,12 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) // connection establish packet must always be at least 6 bytes long as we must have a version number, no matter how it changes if (e->mBuffer[0] == 0 && e->mBuffer[1] == UdpConnection::cUdpPacketConnect && e->mLen == UdpConnection::cUdpPacketConnectSize) { - if (mParams.maxConnectionsPerIP > 0) + if (mParams.maxConnectionsPerIP > 0 && (mIpConnectionCount[e->mIp.GetAddress()] >= mParams.maxConnectionsPerIP)) { - if (mIpConnectionCount[e->mIp.GetAddress()] >= mParams.maxConnectionsPerIP) - { - // add a strike if they're over the count - addStrike(e->mIp, 1); + // add a strike if they're over the count + addStrike(e->mIp, 1); - return; - } + return; } if (mConnectionListCount >= mParams.maxConnections)