Core/PacketIO: Prevented excessive WhoOpcode spam - solves possible crash/lag method

This commit is contained in:
danik
2012-01-06 19:36:17 +01:00
parent 803acccb07
commit b35f831f2b
3 changed files with 7 additions and 1 deletions

View File

@@ -169,6 +169,11 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message");
time_t now = time(NULL);
if (now - timeLastWhoCommand < 5)
return;
else timeLastWhoCommand = now;
uint32 matchcount = 0;
uint32 level_min, level_max, racemask, classmask, zones_count, str_count;

View File

@@ -94,7 +94,7 @@ m_playerRecentlyLogout(false), m_playerSave(false),
m_sessionDbcLocale(sWorld->GetAvailableDbcLocale(locale)),
m_sessionDbLocaleIndex(locale),
m_latency(0), m_TutorialsChanged(false), recruiterId(recruiter),
isRecruiter(isARecruiter)
isRecruiter(isARecruiter), timeLastWhoCommand(0)
{
if (sock)
{

View File

@@ -949,6 +949,7 @@ class WorldSession
uint32 recruiterId;
bool isRecruiter;
ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue;
time_t timeLastWhoCommand;
};
#endif
/// @}