Skip to content

Commit

Permalink
Eliminate race condition in World Log.
Browse files Browse the repository at this point in the history
In has been introduced with multithreaded packet processing, and prevents the dump from being written correctly, e.g. with tools.
  • Loading branch information
LordJZ authored and Salja committed Aug 1, 2012
1 parent 19c201e commit 18e130e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/shared/Log.cpp
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/shared/Log.h
Expand Up @@ -167,6 +167,7 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ACE_Th
FILE* charLogfile;
FILE* dberLogfile;
FILE* worldLogfile;
ACE_Thread_Mutex m_worldLogMtx;

// log/console control
LogLevel m_logLevel;
Expand Down

0 comments on commit 18e130e

Please sign in to comment.