1
0
Fork 0

Synchronously save chunks on server shutdown (#4900)

+ Synchronously save chunks on server shutdown. Fixes #4884
This commit is contained in:
Alexander Harkness 2020-09-21 12:12:09 +00:00 committed by GitHub
parent b6b7fb1a65
commit 8de71fc9d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View File

@ -577,6 +577,18 @@ void cRoot::SaveAllChunks(void)
void cRoot::SaveAllChunksNow(void)
{
for (auto & Entry : m_WorldsByName)
{
Entry.second.SaveAllChunks();
}
}
void cRoot::SetSavingEnabled(bool a_SavingEnabled)
{
for (auto & Entry : m_WorldsByName)

View File

@ -140,6 +140,9 @@ public:
/** Saves all chunks in all worlds */
void SaveAllChunks(void); // tolua_export
/** Saves all chunks in all worlds synchronously (waits until dirty chunks have been sent to the ChunkStorage queue before returning) */
void SaveAllChunksNow(void);
/** Sets whether saving chunks is enabled in all worlds (overrides however the worlds were already set) */
void SetSavingEnabled(bool a_SavingEnabled); // tolua_export

View File

@ -648,7 +648,8 @@ void cServer::Shutdown(void)
// Notify the tick thread and wait for it to terminate:
m_TickThread.Stop();
cRoot::Get()->SaveAllChunks();
// Save all chunks in all worlds, wait for chunks to be sent to the ChunkStorage queue for each world:
cRoot::Get()->SaveAllChunksNow();
// Remove all clients:
cCSLock Lock(m_CSClients);