@@ -1225,7 +1225,7 @@ void Log::outErrorScriptLib(const char* err, ...)
12251225 }
12261226}
12271227
1228- void Log::outWorldPacketDump (uint32 socket , uint32 opcode, char const * opcodeName, ByteBuffer const * packet, bool incoming)
1228+ void Log::outWorldPacketDump (uint32 session , uint32 opcode, char const * opcodeName, ByteBuffer const * packet, bool incoming)
12291229{
12301230 if (!worldLogfile)
12311231 {
@@ -1237,18 +1237,19 @@ void Log::outWorldPacketDump(uint32 socket, uint32 opcode, char const* opcodeNam
12371237 outTimestamp (worldLogfile);
12381238
12391239 // Build the whole hex dump into one buffer and emit it with a single
1240- // fwrite, instead of one fprintf PER BYTE (16+ stdio calls per row). Output
1241- // is byte-identical to the previous format. Durability via Flush()/shutdown.
1240+ // fwrite, instead of one fprintf PER BYTE (16+ stdio calls per row). The hex
1241+ // body is byte-identical to that format. Durability via Flush()/shutdown.
12421242 std::string out;
12431243 out.reserve (packet->size () * 3 + packet->size () / 16 + 128 );
12441244
1245- // header[512] is ample for the fixed text plus a (short, compile-time)
1246- // opcode-name constant; snprintf is bounded, so output stays byte-identical
1247- // to the previous fprintf for every real opcode name.
1245+ // SESSION, not SOCKET: the field carried a hardcoded 0 for every packet of every
1246+ // client, so two clients logged as one interleaved stream that could not be taken
1247+ // apart. header[512] is ample for the fixed text plus a (short, compile-time)
1248+ // opcode-name constant, and snprintf is bounded.
12481249 char header[512 ];
1249- snprintf (header, sizeof (header), " \n %s:\n SOCKET : %u\n LENGTH: %zu\n OPCODE: %s (0x%.4X)\n DATA:\n " ,
1250+ snprintf (header, sizeof (header), " \n %s:\n SESSION : %u\n LENGTH: %zu\n OPCODE: %s (0x%.4X)\n DATA:\n " ,
12501251 incoming ? " CLIENT" : " SERVER" ,
1251- socket , packet->size (), opcodeName, opcode);
1252+ session , packet->size (), opcodeName, opcode);
12521253 out += header;
12531254
12541255 char hexbuf[4 ];
0 commit comments