From 18e130ea47d606d52b1243e27e4c309f3e7bdc2b Mon Sep 17 00:00:00 2001 From: LordJZ Date: Tue, 31 Jul 2012 00:38:45 +0400 Subject: [PATCH] Eliminate race condition in World Log. In has been introduced with multithreaded packet processing, and prevents the dump from being written correctly, e.g. with tools. --- src/shared/Log.cpp | 2 ++ src/shared/Log.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index 075a9ef4c12..a66c06fe6d9 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -714,6 +714,8 @@ void Log::outWorldPacketDump( uint32 socket, uint32 opcode, char const* opcodeNa if (!worldLogfile) return; + ACE_GUARD(ACE_Thread_Mutex, GuardObj, m_worldLogMtx); + outTimestamp(worldLogfile); fprintf(worldLogfile,"\n%s:\nSOCKET: %u\nLENGTH: " SIZEFMTD "\nOPCODE: %s (0x%.4X)\nDATA:\n", diff --git a/src/shared/Log.h b/src/shared/Log.h index 8502d4421d5..fa3ebd5c967 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -167,6 +167,7 @@ class Log : public MaNGOS::Singleton