feat(Core/PacketIO): correct parsing some opcodes (#6051)

This commit is contained in:
Kargatum
2021-05-28 05:34:54 +07:00
committed by GitHub
parent c1e96064e9
commit d8911d816f
6 changed files with 214 additions and 150 deletions

View File

@@ -184,9 +184,14 @@ std::string WorldSession::GetPlayerInfo() const
{
std::ostringstream ss;
ss << "[Player: " << GetPlayerName()
<< " (Guid: " << (_player != nullptr ? _player->GetGUID() : 0)
<< ", Account: " << GetAccountId() << ")]";
ss << "[Player: ";
if (!m_playerLoading && _player)
{
ss << _player->GetName() << ' ' << _player->GetGUID().ToString() << ", ";
}
ss << "Account: " << GetAccountId() << "]";
return ss.str();
}
@@ -202,7 +207,7 @@ void WorldSession::SendPacket(WorldPacket const* packet)
{
if (packet->GetOpcode() == NULL_OPCODE)
{
LOG_ERROR("server", "WorldSession::SendPacket(packet) called, but packet->GetOpcode() was NULL_OPCODE");
LOG_ERROR("network.opcode", "%s send NULL_OPCODE", GetPlayerInfo().c_str());
return;
}
@@ -252,6 +257,8 @@ void WorldSession::SendPacket(WorldPacket const* packet)
return;
#endif
LOG_TRACE("network.opcode", "S->C: %s %s", GetPlayerInfo().c_str(), GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet->GetOpcode())).c_str());
if (m_Socket->SendPacket(*packet) == -1)
m_Socket->CloseSocket("m_Socket->SendPacket(*packet) == -1");
}
@@ -399,7 +406,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
deletePacket = true;
#define MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE 100
#define MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE 150
processedPackets++;
//process only a max amout of packets in 1 Update() call.