Core/Networking: Fixed deadlock in HandlePing if the client is about to be kicked for overspeed pings

This commit is contained in:
Shauren
2015-04-01 01:47:40 +02:00
parent 5389180778
commit 3da0f7e409

View File

@@ -832,13 +832,15 @@ void WorldSocket::HandlePing(WorldPacket& recvPacket)
if (maxAllowed && _OverSpeedPings > maxAllowed)
{
std::lock_guard<std::mutex> sessionGuard(_worldSessionLock);
std::unique_lock<std::mutex> sessionGuard(_worldSessionLock);
if (_worldSession && !_worldSession->HasPermission(rbac::RBAC_PERM_SKIP_CHECK_OVERSPEED_PING))
{
TC_LOG_ERROR("network", "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)",
_worldSession->GetPlayerInfo().c_str(), GetRemoteIpAddress().to_string().c_str());
// this is bad but we will pretend this code isn't here - it only happens once per socket in worst case
sessionGuard.unlock();
CloseSocket();
return;
}