aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/Logging/Log.cpp7
-rw-r--r--src/common/Logging/Log.h1
-rw-r--r--src/server/worldserver/Main.cpp2
3 files changed, 10 insertions, 0 deletions
diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp
index de2c02bf2ed..f7a84fb8b47 100644
--- a/src/common/Logging/Log.cpp
+++ b/src/common/Logging/Log.cpp
@@ -337,6 +337,13 @@ void Log::Initialize(boost::asio::io_service* ioService)
LoadFromConfig();
}
+void Log::SetSynchronous()
+{
+ delete _strand;
+ _strand = nullptr;
+ _ioService = nullptr;
+}
+
void Log::LoadFromConfig()
{
Close();
diff --git a/src/common/Logging/Log.h b/src/common/Logging/Log.h
index 6f9c5600775..062f14d525c 100644
--- a/src/common/Logging/Log.h
+++ b/src/common/Logging/Log.h
@@ -47,6 +47,7 @@ class Log
static Log* instance();
void Initialize(boost::asio::io_service* ioService);
+ void SetSynchronous(); // Not threadsafe - should only be called from main() after all threads are joined
void LoadFromConfig();
void Close();
bool ShouldLog(std::string const& type, LogLevel level) const;
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp
index fe6baf2fccb..0b8f0a92fa0 100644
--- a/src/server/worldserver/Main.cpp
+++ b/src/server/worldserver/Main.cpp
@@ -243,6 +243,8 @@ extern int main(int argc, char** argv)
// Shutdown starts here
ShutdownThreadPool(threadPool);
+ sLog->SetSynchronous();
+
sScriptMgr->OnShutdown();
sWorld->KickAll(); // save and kick all players