mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 00:23:48 +00:00
feat(Core/Logging): rework logging (#4692)
* feat(Core/Logging): rework logging * correct level for sql.sql * del unused config options * Correct build * correct after merge * whitespace 20:29:37 1. 'Player.cpp'. Replace (1) 20:29:37 2. 'ObjectMgr.cpp'. Replace (3) * 1 * correct logging * correct affter merge * 1 * 2 * LOG_LEVEL_WARN * #include "AppenderDB.h" * 3 * 4 * 5 * 1. 'WorldSocket.cpp'. Replace (1) * 6 * 1
This commit is contained in:
@@ -223,9 +223,9 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||
uint64 minTime = uint64(cur_time - lastTime);
|
||||
uint64 fullTime = uint64(lastTime - firstTime);
|
||||
|
||||
sLog->outDetail("Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount) / fullTime, float(sendPacketBytes) / fullTime, uint32(fullTime));
|
||||
LOG_DEBUG("server", "Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount) / fullTime, float(sendPacketBytes) / fullTime, uint32(fullTime));
|
||||
|
||||
sLog->outDetail("Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount) / minTime, float(sendLastPacketBytes) / minTime);
|
||||
LOG_DEBUG("server", "Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount) / minTime, float(sendLastPacketBytes) / minTime);
|
||||
|
||||
lastTime = cur_time;
|
||||
sendLastPacketCount = 1;
|
||||
@@ -277,7 +277,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
{
|
||||
if (packet->GetOpcode() >= NUM_MSG_TYPES)
|
||||
{
|
||||
sLog->outError("WorldSession Packet filter: received non-existent opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
|
||||
LOG_ERROR("server", "WorldSession Packet filter: received non-existent opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -359,10 +359,10 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
}
|
||||
catch (ByteBufferException const&)
|
||||
{
|
||||
sLog->outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
|
||||
if (sLog->IsOutDebug())
|
||||
LOG_ERROR("server", "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
|
||||
if (sLog->ShouldLog("network", LogLevel::LOG_LEVEL_DEBUG))
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:");
|
||||
LOG_DEBUG("network", "Dumping error causing packet:");
|
||||
packet->hexlike();
|
||||
}
|
||||
}
|
||||
@@ -594,7 +594,7 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
//! Call script hook before deletion
|
||||
sScriptMgr->OnPlayerLogout(_player);
|
||||
|
||||
sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName().c_str(), _player->GetGUIDLow(), _player->getLevel());
|
||||
LOG_INFO("entities.player", "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName().c_str(), _player->GetGUIDLow(), _player->getLevel());
|
||||
|
||||
//! Remove the player from the world
|
||||
// the player may not be in the world when logging out
|
||||
@@ -614,7 +614,7 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
WorldPacket data(SMSG_LOGOUT_COMPLETE, 0);
|
||||
SendPacket(&data);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
|
||||
LOG_DEBUG("network", "SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
|
||||
#endif
|
||||
|
||||
//! Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline
|
||||
@@ -680,22 +680,22 @@ char const* WorldSession::GetAcoreString(uint32 entry) const
|
||||
|
||||
void WorldSession::Handle_NULL(WorldPacket& recvPacket)
|
||||
{
|
||||
sLog->outError("SESSION: received unhandled opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
|
||||
LOG_ERROR("server", "SESSION: received unhandled opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
|
||||
}
|
||||
|
||||
void WorldSession::Handle_EarlyProccess(WorldPacket& recvPacket)
|
||||
{
|
||||
sLog->outError("SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
|
||||
LOG_ERROR("server", "SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
|
||||
}
|
||||
|
||||
void WorldSession::Handle_ServerSide(WorldPacket& recvPacket)
|
||||
{
|
||||
sLog->outError("SESSION: received server-side opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
|
||||
LOG_ERROR("server", "SESSION: received server-side opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
|
||||
}
|
||||
|
||||
void WorldSession::Handle_Deprecated(WorldPacket& recvPacket)
|
||||
{
|
||||
sLog->outError("SESSION: received deprecated opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
|
||||
LOG_ERROR("server", "SESSION: received deprecated opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
|
||||
}
|
||||
|
||||
void WorldSession::SendAuthWaitQue(uint32 position)
|
||||
@@ -738,13 +738,13 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
|
||||
uint32 type = fields[0].GetUInt8();
|
||||
if (type >= NUM_ACCOUNT_DATA_TYPES)
|
||||
{
|
||||
sLog->outError("Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
LOG_ERROR("server", "Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((mask & (1 << type)) == 0)
|
||||
{
|
||||
sLog->outError("Table `%s` have non appropriate for table account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
LOG_ERROR("server", "Table `%s` have non appropriate for table account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -877,7 +877,7 @@ void WorldSession::ReadMovementInfo(WorldPacket& data, MovementInfo* mi)
|
||||
{ \
|
||||
if (check) \
|
||||
{ \
|
||||
sLog->outDebug(LOG_FILTER_UNITS, "WorldSession::ReadMovementInfo: Violation of MovementFlags found (%s). " \
|
||||
LOG_DEBUG("entities.unit", "WorldSession::ReadMovementInfo: Violation of MovementFlags found (%s). " \
|
||||
"MovementFlags: %u, MovementFlags2: %u for player GUID: %u. Mask %u will be removed.", \
|
||||
STRINGIZE(check), mi->GetMovementFlags(), mi->GetExtraMovementFlags(), GetPlayer()->GetGUIDLow(), maskToRemove); \
|
||||
mi->RemoveMovementFlag((maskToRemove)); \
|
||||
@@ -1000,7 +1000,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data)
|
||||
|
||||
if (size > 0xFFFFF)
|
||||
{
|
||||
sLog->outError("WorldSession::ReadAddonsInfo addon info too big, size %u", size);
|
||||
LOG_ERROR("server", "WorldSession::ReadAddonsInfo addon info too big, size %u", size);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1031,7 +1031,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data)
|
||||
addonInfo >> enabled >> crc >> unk1;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
|
||||
LOG_DEBUG("server", "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
|
||||
#endif
|
||||
|
||||
AddonInfo addon(addonName, enabled, crc, 2, true);
|
||||
@@ -1046,9 +1046,9 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data)
|
||||
match = false;
|
||||
|
||||
if (!match)
|
||||
sLog->outDetail("ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC);
|
||||
LOG_DEBUG("server", "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC);
|
||||
else
|
||||
sLog->outDetail("ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC);
|
||||
LOG_DEBUG("server", "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@@ -1056,7 +1056,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data)
|
||||
AddonMgr::SaveAddon(addon);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC);
|
||||
LOG_DEBUG("server", "ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1067,16 +1067,16 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data)
|
||||
uint32 currentTime;
|
||||
addonInfo >> currentTime;
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "ADDON: CurrentTime: %u", currentTime);
|
||||
LOG_DEBUG("network", "ADDON: CurrentTime: %u", currentTime);
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
if (addonInfo.rpos() != addonInfo.size())
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "packet under-read!");
|
||||
LOG_DEBUG("network", "packet under-read!");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
sLog->outError("Addon packet uncompress error!");
|
||||
LOG_ERROR("server", "Addon packet uncompress error!");
|
||||
}
|
||||
|
||||
void WorldSession::SendAddonsInfo()
|
||||
@@ -1116,7 +1116,7 @@ void WorldSession::SendAddonsInfo()
|
||||
if (usepk) // if CRC is wrong, add public key (client need it)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey", itr->CRC, itr->Name.c_str(), STANDARD_ADDON_CRC);
|
||||
LOG_DEBUG("server", "ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey", itr->CRC, itr->Name.c_str(), STANDARD_ADDON_CRC);
|
||||
#endif
|
||||
data.append(addonPublicKey, sizeof(addonPublicKey));
|
||||
}
|
||||
@@ -1364,7 +1364,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
|
||||
if (++packetCounter.amountCounter <= maxPacketCounterAllowed)
|
||||
return true;
|
||||
|
||||
sLog->outString("AntiDOS: Account %u, IP: %s, Ping: %u, Character %s, flooding packet (opc: %s (0x%X), count: %u)",
|
||||
LOG_INFO("server", "AntiDOS: Account %u, IP: %s, Ping: %u, Character %s, flooding packet (opc: %s (0x%X), count: %u)",
|
||||
Session->GetAccountId(), Session->GetRemoteAddress().c_str(), Session->GetLatency(),
|
||||
Session->GetPlayerName().c_str(), opcodeTable[p.GetOpcode()].name, p.GetOpcode(), packetCounter.amountCounter);
|
||||
|
||||
@@ -1374,7 +1374,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
|
||||
return true;
|
||||
case POLICY_KICK:
|
||||
{
|
||||
sLog->outString("AntiDOS: Player %s kicked!", Session->GetPlayerName().c_str());
|
||||
LOG_INFO("server", "AntiDOS: Player %s kicked!", Session->GetPlayerName().c_str());
|
||||
Session->KickPlayer();
|
||||
return false;
|
||||
}
|
||||
@@ -1395,7 +1395,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
|
||||
break;
|
||||
}
|
||||
|
||||
sLog->outString("AntiDOS: Player automatically banned for %u seconds.", duration);
|
||||
LOG_INFO("server", "AntiDOS: Player automatically banned for %u seconds.", duration);
|
||||
return false;
|
||||
}
|
||||
default: // invalid policy
|
||||
|
||||
@@ -53,7 +53,7 @@ struct ServerPktHeader
|
||||
uint8 headerIndex = 0;
|
||||
if (isLargePacket())
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "initializing large server to client packet. Size: %u, cmd: %u", size, cmd);
|
||||
LOG_DEBUG("network", "initializing large server to client packet. Size: %u, cmd: %u", size, cmd);
|
||||
header[headerIndex++] = 0x80 | (0xFF & (size >> 16));
|
||||
}
|
||||
header[headerIndex++] = 0xFF & (size >> 8);
|
||||
@@ -123,7 +123,7 @@ bool WorldSocket::IsClosed(void) const
|
||||
void WorldSocket::CloseSocket(std::string const& reason)
|
||||
{
|
||||
if (!reason.empty())
|
||||
sLog->outDebug(LOG_FILTER_CLOSE_SOCKET, "Socket closed because of: %s", reason.c_str());
|
||||
LOG_DEBUG("network", "Socket closed because of: %s", reason.c_str());
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(m_OutBufferLock);
|
||||
@@ -187,7 +187,7 @@ int WorldSocket::SendPacket(WorldPacket const& pct)
|
||||
|
||||
if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
|
||||
{
|
||||
sLog->outError("WorldSocket::SendPacket enqueue_tail failed");
|
||||
LOG_ERROR("server", "WorldSocket::SendPacket enqueue_tail failed");
|
||||
mb->release();
|
||||
return -1;
|
||||
}
|
||||
@@ -230,7 +230,7 @@ int WorldSocket::open(void* a)
|
||||
|
||||
if (peer().get_remote_addr(remote_addr) == -1)
|
||||
{
|
||||
sLog->outError("WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
|
||||
LOG_ERROR("server", "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ int WorldSocket::open(void* a)
|
||||
// Register with ACE Reactor
|
||||
if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1)
|
||||
{
|
||||
sLog->outError("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
|
||||
LOG_ERROR("server", "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ int WorldSocket::handle_input(ACE_HANDLE)
|
||||
}
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outStaticDebug("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
|
||||
LOG_DEBUG("server", "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
|
||||
#endif
|
||||
|
||||
errno = ECONNRESET;
|
||||
@@ -294,7 +294,7 @@ int WorldSocket::handle_input(ACE_HANDLE)
|
||||
case 0:
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outStaticDebug("WorldSocket::handle_input: Peer has closed connection");
|
||||
LOG_DEBUG("server", "WorldSocket::handle_input: Peer has closed connection");
|
||||
#endif
|
||||
|
||||
errno = ECONNRESET;
|
||||
@@ -364,7 +364,7 @@ int WorldSocket::handle_output_queue()
|
||||
|
||||
if (msg_queue()->dequeue_head(mblk, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
|
||||
{
|
||||
sLog->outError("WorldSocket::handle_output_queue dequeue_head");
|
||||
LOG_ERROR("server", "WorldSocket::handle_output_queue dequeue_head");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -399,7 +399,7 @@ int WorldSocket::handle_output_queue()
|
||||
|
||||
if (msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1)
|
||||
{
|
||||
sLog->outError("WorldSocket::handle_output_queue enqueue_head");
|
||||
LOG_ERROR("server", "WorldSocket::handle_output_queue enqueue_head");
|
||||
mblk->release();
|
||||
return -1;
|
||||
}
|
||||
@@ -478,7 +478,7 @@ int WorldSocket::handle_input_header(void)
|
||||
if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240))
|
||||
{
|
||||
Player* _player = m_Session ? m_Session->GetPlayer() : nullptr;
|
||||
sLog->outError("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", m_Session ? m_Session->GetAccountId() : 0, _player ? _player->GetGUIDLow() : 0, _player ? _player->GetName().c_str() : "<none>", header.size, header.cmd);
|
||||
LOG_ERROR("server", "WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", m_Session ? m_Session->GetAccountId() : 0, _player ? _player->GetGUIDLow() : 0, _player ? _player->GetName().c_str() : "<none>", header.size, header.cmd);
|
||||
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
@@ -580,7 +580,7 @@ int WorldSocket::handle_input_missing_data(void)
|
||||
// hope this is not hack, as proper m_RecvWPct is asserted around
|
||||
if (!m_RecvWPct)
|
||||
{
|
||||
sLog->outError("Forcing close on input m_RecvWPct = nullptr");
|
||||
LOG_ERROR("server", "Forcing close on input m_RecvWPct = nullptr");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
@@ -624,7 +624,7 @@ int WorldSocket::cancel_wakeup_output()
|
||||
(this, ACE_Event_Handler::WRITE_MASK) == -1)
|
||||
{
|
||||
// would be good to store errno from reactor with errno guard
|
||||
sLog->outError("WorldSocket::cancel_wakeup_output");
|
||||
LOG_ERROR("server", "WorldSocket::cancel_wakeup_output");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -641,7 +641,7 @@ int WorldSocket::schedule_wakeup_output()
|
||||
if (reactor()->schedule_wakeup
|
||||
(this, ACE_Event_Handler::WRITE_MASK) == -1)
|
||||
{
|
||||
sLog->outError("WorldSocket::schedule_wakeup_output");
|
||||
LOG_ERROR("server", "WorldSocket::schedule_wakeup_output");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -675,13 +675,13 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
|
||||
return HandlePing(*new_pct);
|
||||
}
|
||||
catch (ByteBufferPositionException const&) {}
|
||||
sLog->outError("WorldSocket::ReadDataHandler(): client sent malformed CMSG_PING");
|
||||
LOG_ERROR("server", "WorldSocket::ReadDataHandler(): client sent malformed CMSG_PING");
|
||||
return -1;
|
||||
}
|
||||
case CMSG_AUTH_SESSION:
|
||||
if (m_Session)
|
||||
{
|
||||
sLog->outError("WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again");
|
||||
LOG_ERROR("server", "WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again");
|
||||
return -1;
|
||||
}
|
||||
return HandleAuthSession (*new_pct);
|
||||
@@ -706,7 +706,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outError("WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
|
||||
LOG_ERROR("server", "WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -714,10 +714,10 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
|
||||
}
|
||||
catch (ByteBufferException const&)
|
||||
{
|
||||
sLog->outError("WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.", opcode, GetRemoteAddress().c_str(), m_Session ? m_Session->GetAccountId() : -1);
|
||||
if (sLog->IsOutDebug())
|
||||
LOG_ERROR("server", "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.", opcode, GetRemoteAddress().c_str(), m_Session ? m_Session->GetAccountId() : -1);
|
||||
if (sLog->ShouldLog("network", LogLevel::LOG_LEVEL_DEBUG))
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:");
|
||||
LOG_DEBUG("network", "Dumping error causing packet:");
|
||||
new_pct->hexlike();
|
||||
}
|
||||
|
||||
@@ -751,7 +751,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
packet << uint8(AUTH_REJECT);
|
||||
SendPacket(packet);
|
||||
|
||||
sLog->outError("WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
|
||||
LOG_ERROR("server", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -768,7 +768,8 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
recvPacket.read(digest);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outStaticDebug ("WorldSocket::HandleAuthSession: client %u, loginServerID %u, account %s, loginServerType %u, clientseed %u", BuiltNumberClient, loginServerID, account.c_str(), loginServerType, clientSeed);
|
||||
LOG_DEBUG("server", "WorldSocket::HandleAuthSession: client %u, loginServerID %u, account %s, loginServerType %u",
|
||||
BuiltNumberClient, loginServerID, account.c_str(), loginServerType);
|
||||
#endif
|
||||
// Get the account information from the realmd database
|
||||
// 0 1 2 3 4 5 6 7 8 9 10
|
||||
@@ -788,7 +789,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
|
||||
SendPacket(packet);
|
||||
|
||||
sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
|
||||
LOG_ERROR("server", "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -823,7 +824,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
packet << uint8 (AUTH_FAILED);
|
||||
SendPacket(packet);
|
||||
|
||||
sLog->outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", fields[2].GetCString(), address.c_str());
|
||||
LOG_INFO("server", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", fields[2].GetCString(), address.c_str());
|
||||
// We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well
|
||||
sScriptMgr->OnFailedAccountLogin(id);
|
||||
return -1;
|
||||
@@ -866,7 +867,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
packet << uint8(AUTH_REJECT);
|
||||
SendPacket(packet);
|
||||
|
||||
sLog->outError("WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", address.c_str(), os.c_str());
|
||||
LOG_ERROR("server", "WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", address.c_str(), os.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -901,7 +902,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
packet << uint8 (AUTH_BANNED);
|
||||
SendPacket(packet);
|
||||
|
||||
sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
|
||||
LOG_ERROR("server", "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
|
||||
sScriptMgr->OnFailedAccountLogin(id);
|
||||
return -1;
|
||||
}
|
||||
@@ -909,7 +910,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
// Check locked state for server
|
||||
AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Allowed Level: %u Player Level %u", allowedAccountType, AccountTypes(security));
|
||||
LOG_DEBUG("network", "Allowed Level: %u Player Level %u", allowedAccountType, AccountTypes(security));
|
||||
#endif
|
||||
if (AccountTypes(security) < allowedAccountType)
|
||||
{
|
||||
@@ -919,7 +920,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
SendPacket(packet);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
|
||||
LOG_DEBUG("server", "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
|
||||
#endif
|
||||
sScriptMgr->OnFailedAccountLogin(id);
|
||||
return -1;
|
||||
@@ -943,12 +944,12 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
|
||||
SendPacket(packet);
|
||||
|
||||
sLog->outError("WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str());
|
||||
LOG_ERROR("server", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outStaticDebug("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
|
||||
LOG_DEBUG("server", "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
|
||||
account.c_str(),
|
||||
address.c_str());
|
||||
#endif
|
||||
@@ -985,7 +986,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
packet << uint8 (AUTH_REJECT);
|
||||
SendPacket(packet);
|
||||
|
||||
sLog->outError("WorldSocket::HandleAuthSession: World closed, denying client (%s).", address.c_str());
|
||||
LOG_ERROR("server", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", address.c_str());
|
||||
sScriptMgr->OnFailedAccountLogin(id);
|
||||
return -1;
|
||||
}
|
||||
@@ -996,7 +997,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
packet << uint8 (REALM_LIST_REALM_NOT_FOUND);
|
||||
SendPacket(packet);
|
||||
|
||||
sLog->outError("WorldSocket::HandleAuthSession: Client %s requested connecting with realm id %u but this realm has id %u set in config.",
|
||||
LOG_ERROR("server", "WorldSocket::HandleAuthSession: Client %s requested connecting with realm id %u but this realm has id %u set in config.",
|
||||
address.c_str(), realm, realmID);
|
||||
sScriptMgr->OnFailedAccountLogin(id);
|
||||
return -1;
|
||||
@@ -1052,7 +1053,7 @@ int WorldSocket::HandlePing(WorldPacket& recvPacket)
|
||||
if (m_Session && AccountMgr::IsPlayerAccount(m_Session->GetSecurity()))
|
||||
{
|
||||
Player* _player = m_Session->GetPlayer();
|
||||
sLog->outError("WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)",
|
||||
LOG_ERROR("server", "WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)",
|
||||
m_Session->GetAccountId(),
|
||||
_player ? _player->GetGUIDLow() : 0,
|
||||
_player ? _player->GetName().c_str() : "<none>",
|
||||
@@ -1077,7 +1078,7 @@ int WorldSocket::HandlePing(WorldPacket& recvPacket)
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outError("WorldSocket::HandlePing: peer sent CMSG_PING, "
|
||||
LOG_ERROR("server", "WorldSocket::HandlePing: peer sent CMSG_PING, "
|
||||
"but is not authenticated or got recently kicked, "
|
||||
" address = %s",
|
||||
GetRemoteAddress().c_str());
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
protected:
|
||||
virtual int handle_timeout(const ACE_Time_Value& /*current_time*/, const void* /*act = 0*/)
|
||||
{
|
||||
sLog->outBasic("Resuming acceptor");
|
||||
LOG_INFO("server", "Resuming acceptor");
|
||||
reactor()->cancel_timer(this, 1);
|
||||
return reactor()->register_handler(this, ACE_Event_Handler::ACCEPT_MASK);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ protected:
|
||||
#if defined(ENFILE) && defined(EMFILE)
|
||||
if (errno == ENFILE || errno == EMFILE)
|
||||
{
|
||||
sLog->outError("Out of file descriptors, suspending incoming connections for 10 seconds");
|
||||
LOG_ERROR("server", "Out of file descriptors, suspending incoming connections for 10 seconds");
|
||||
reactor()->remove_handler(this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL);
|
||||
reactor()->schedule_timer(this, nullptr, ACE_Time_Value(10));
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ protected:
|
||||
int svc() override
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outStaticDebug ("Network Thread Starting");
|
||||
LOG_DEBUG("server", "Network Thread Starting");
|
||||
#endif
|
||||
|
||||
ASSERT(m_Reactor);
|
||||
@@ -177,7 +177,7 @@ protected:
|
||||
}
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outStaticDebug ("Network Thread exits");
|
||||
LOG_DEBUG("server", "Network Thread exits");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
@@ -228,7 +228,7 @@ WorldSocketMgr::StartReactiveIO (uint16 port, const char* address)
|
||||
|
||||
if (num_threads <= 0)
|
||||
{
|
||||
sLog->outError("Network.Threads is wrong in your config file");
|
||||
LOG_ERROR("server", "Network.Threads is wrong in your config file");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ WorldSocketMgr::StartReactiveIO (uint16 port, const char* address)
|
||||
|
||||
m_NetThreads = new ReactorRunnable[m_NetThreadsCount];
|
||||
|
||||
sLog->outBasic ("Max allowed socket connections %d", ACE::max_handles());
|
||||
LOG_INFO("server", "Max allowed socket connections %d", ACE::max_handles());
|
||||
|
||||
// -1 means use default
|
||||
m_SockOutKBuff = sConfigMgr->GetOption<int32> ("Network.OutKBuff", -1);
|
||||
@@ -245,7 +245,7 @@ WorldSocketMgr::StartReactiveIO (uint16 port, const char* address)
|
||||
|
||||
if (m_SockOutUBuff <= 0)
|
||||
{
|
||||
sLog->outError("Network.OutUBuff is wrong in your config file");
|
||||
LOG_ERROR("server", "Network.OutUBuff is wrong in your config file");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ WorldSocketMgr::StartReactiveIO (uint16 port, const char* address)
|
||||
|
||||
if (m_Acceptor->open(listen_addr, m_NetThreads[0].GetReactor(), ACE_NONBLOCK) == -1)
|
||||
{
|
||||
sLog->outError("Failed to open acceptor, check if the port is free");
|
||||
LOG_ERROR("server", "Failed to open acceptor, check if the port is free");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -268,8 +268,8 @@ WorldSocketMgr::StartReactiveIO (uint16 port, const char* address)
|
||||
int
|
||||
WorldSocketMgr::StartNetwork (uint16 port, const char* address)
|
||||
{
|
||||
if (!sLog->IsOutDebug())
|
||||
ACE_Log_Msg::instance()->priority_mask (LM_ERROR, ACE_Log_Msg::PROCESS);
|
||||
if (!sLog->ShouldLog("network", LogLevel::LOG_LEVEL_DEBUG))
|
||||
ACE_Log_Msg::instance()->priority_mask(LM_ERROR, ACE_Log_Msg::PROCESS);
|
||||
|
||||
if (StartReactiveIO(port, address) == -1)
|
||||
return -1;
|
||||
@@ -319,7 +319,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
|
||||
(void*) & m_SockOutKBuff,
|
||||
sizeof (int)) == -1 && errno != ENOTSUP)
|
||||
{
|
||||
sLog->outError("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
|
||||
LOG_ERROR("server", "WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -334,7 +334,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
|
||||
(void*)&ndoption,
|
||||
sizeof (int)) == -1)
|
||||
{
|
||||
sLog->outError("WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno));
|
||||
LOG_ERROR("server", "WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user