add additional logging to save thread, stop winsocknetlayer listning on server shutdown

This commit is contained in:
sylvessa 2026-04-06 21:29:32 -05:00
parent 098582dea8
commit 0ccd327b3f
4 changed files with 59 additions and 20 deletions

View file

@ -705,6 +705,7 @@ int main(int argc, char **argv)
LogWorldIO("Waiting for autosave to complete...");
}
WinsockNetLayer::StopListening();
MinecraftServer::HaltServer();
if (g_NetworkManager.ServerStoppedValid())
@ -719,9 +720,22 @@ int main(int argc, char **argv)
waitThread.WaitForCompletion(INFINITE);
}
DWORD bgWaitStart = GetTickCount();
DWORD lastHeartbeat = bgWaitStart;
if (ConsoleSaveFileOriginal::hasPendingBackgroundSave())
{
LogInfof("shutdown", "Waiting for background save to complete...");
}
while (ConsoleSaveFileOriginal::hasPendingBackgroundSave())
{
TickCoreSystems();
DWORD now = GetTickCount();
if ((LONG)(now - lastHeartbeat) >= 5000)
{
LogInfof("shutdown", "waiting for background save to complete... (%u sec elapsed)", (now - bgWaitStart) / 1000);
lastHeartbeat = now;
}
Sleep(10);
}