diff options
-rw-r--r-- | src/server.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/server.cpp b/src/server.cpp index 73df81dde..5b9903f5a 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1139,19 +1139,23 @@ Server::~Server() {} } } + + { + JMutexAutoLock envlock(m_env_mutex); - /* - Save players - */ - dstream<<"Server: Saving players"<<std::endl; - m_env.serializePlayers(m_mapsavedir); + /* + Save players + */ + dstream<<"Server: Saving players"<<std::endl; + m_env.serializePlayers(m_mapsavedir); - /* - Save environment metadata - */ - dstream<<"Server: Saving environment metadata"<<std::endl; - m_env.saveMeta(m_mapsavedir); - + /* + Save environment metadata + */ + dstream<<"Server: Saving environment metadata"<<std::endl; + m_env.saveMeta(m_mapsavedir); + } + /* Stop threads */ @@ -1201,6 +1205,8 @@ void Server::start(unsigned short port) void Server::stop() { DSTACK(__FUNCTION_NAME); + + dout_server<<"Server: Stopping and waiting threads"<<std::endl; // Stop threads (set run=false first so both start stopping) m_thread.setRun(false); |