cleanup on udplib if, and hopefully properly disconnect on unsuccessful

logins to prevent blocking legit users - will have to test dossing after
this
This commit is contained in:
DarthArgus
2016-10-03 00:13:50 -05:00
parent f8f761821b
commit 7a48471d6d
2 changed files with 6 additions and 8 deletions
@@ -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
}
// ----------------------------------------------------------------------------
+4 -7
View File
@@ -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)