mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[8797] Merge WorldLog class into Log class.
* Added AuthSocket::SendPacket() function. * Packet logging now also possible in realmd. * realmd.conf.dist.in updated (added "WorldLogFile" setting).
This commit is contained in:
parent
fc42125cfb
commit
07aa44992b
13 changed files with 117 additions and 183 deletions
|
|
@ -42,7 +42,6 @@
|
|||
#include "WorldSession.h"
|
||||
#include "WorldSocketMgr.h"
|
||||
#include "Log.h"
|
||||
#include "WorldLog.h"
|
||||
|
||||
#if defined( __GNUC__ )
|
||||
#pragma pack(1)
|
||||
|
|
@ -166,24 +165,21 @@ int WorldSocket::SendPacket (const WorldPacket& pct)
|
|||
return -1;
|
||||
|
||||
// Dump outgoing packet.
|
||||
if (sWorldLog.LogWorld ())
|
||||
if (sLog.IsLogWorld())
|
||||
{
|
||||
sWorldLog.Log ("SERVER:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
|
||||
(uint32) get_handle (),
|
||||
pct.size (),
|
||||
LookupOpcodeName (pct.GetOpcode ()),
|
||||
pct.GetOpcode ());
|
||||
sLog.outWorld("S->C - SOCKET: %u LENGTH: %u OPCODE: %s (0x%.4X)\n",
|
||||
uint32(get_handle()), pct.size (), LookupOpcodeName(pct.GetOpcode()), pct.GetOpcode());
|
||||
|
||||
uint32 p = 0;
|
||||
while (p < pct.size ())
|
||||
size_t p = 0;
|
||||
while (p < pct.size())
|
||||
{
|
||||
for (uint32 j = 0; j < 16 && p < pct.size (); j++)
|
||||
sWorldLog.Log ("%.2X ", const_cast<WorldPacket&>(pct)[p++]);
|
||||
for (size_t j = 0; j < 16 && p < pct.size(); ++j)
|
||||
sLog.outWorld("%.2X ", const_cast<WorldPacket&>(pct)[p++]);
|
||||
|
||||
sWorldLog.Log ("\n");
|
||||
sLog.outWorld("\n");
|
||||
}
|
||||
|
||||
sWorldLog.Log ("\n\n");
|
||||
sLog.outWorld("\n\n");
|
||||
}
|
||||
|
||||
ServerPktHeader header(pct.size()+2, pct.GetOpcode());
|
||||
|
|
@ -682,25 +678,25 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
|
|||
return -1;
|
||||
|
||||
// Dump received packet.
|
||||
if (sWorldLog.LogWorld ())
|
||||
if (sLog.IsLogWorld())
|
||||
{
|
||||
sWorldLog.Log ("CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
|
||||
(uint32) get_handle (),
|
||||
new_pct->size (),
|
||||
LookupOpcodeName (new_pct->GetOpcode ()),
|
||||
new_pct->GetOpcode ());
|
||||
sLog.outWorld("C->S - SOCKET: %u LENGTH: %u OPCODE: %s (0x%.4X)\n",
|
||||
uint32(get_handle()), new_pct->size(), LookupOpcodeName(new_pct->GetOpcode()), new_pct->GetOpcode());
|
||||
|
||||
uint32 p = 0;
|
||||
while (p < new_pct->size ())
|
||||
size_t p = 0;
|
||||
while (p < new_pct->size())
|
||||
{
|
||||
for (uint32 j = 0; j < 16 && p < new_pct->size (); j++)
|
||||
sWorldLog.Log ("%.2X ", (*new_pct)[p++]);
|
||||
sWorldLog.Log ("\n");
|
||||
for (size_t j = 0; j < 16 && p < new_pct->size(); ++j)
|
||||
sLog.outWorld("%.2X ", (*new_pct)[p++]);
|
||||
|
||||
sLog.outWorld("\n");
|
||||
}
|
||||
sWorldLog.Log ("\n\n");
|
||||
|
||||
sLog.outWorld("\n\n");
|
||||
}
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
switch(opcode)
|
||||
{
|
||||
case CMSG_PING:
|
||||
|
|
@ -738,13 +734,13 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
|
|||
}
|
||||
}
|
||||
}
|
||||
catch(ByteBufferException &)
|
||||
catch (ByteBufferException &)
|
||||
{
|
||||
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())
|
||||
{
|
||||
sLog.outDebug("Dumping error causing packet:");
|
||||
sLog.outDebug("Dumping error-causing packet:");
|
||||
new_pct->hexlike();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue