From e45969b9eca20cf46685078e0ce5b0f1e8112832 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 2ccb8ce36..6926bc3be 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -717,6 +717,8 @@ void Log::outWorldPacketDump(uint32 socket, uint32 opcode, char const* opcodeNam 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 ab59e6a9b..d38cf7969 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -170,6 +170,7 @@ class Log : public MaNGOS::Singleton