fix: fix stop command shutdown process

add dedicated server shutdown request handling
This commit is contained in:
kuwacom 2026-03-08 18:23:02 +09:00
parent 8b68b81ffa
commit 590241c5ef
3 changed files with 19 additions and 3 deletions

View file

@ -16,6 +16,7 @@
#include "commands\CliCommandStop.h"
#include "commands\CliCommandTp.h"
#include "..\Common\StringUtils.h"
#include "..\ServerShutdown.h"
#include "..\ServerLogger.h"
#include "..\..\Minecraft.Client\MinecraftServer.h"
#include "..\..\Minecraft.Client\PlayerList.h"
@ -188,7 +189,7 @@ namespace ServerRuntime
void ServerCliEngine::RequestShutdown() const
{
MinecraftServer::HaltServer();
RequestDedicatedServerShutdown();
}
std::vector<std::string> ServerCliEngine::GetOnlinePlayerNamesUtf8() const

View file

@ -0,0 +1,6 @@
#pragma once
namespace ServerRuntime
{
void RequestDedicatedServerShutdown();
}

View file

@ -10,6 +10,7 @@
#include "..\ServerLogger.h"
#include "..\ServerLogManager.h"
#include "..\ServerProperties.h"
#include "..\ServerShutdown.h"
#include "..\WorldManager.h"
#include "..\Console\ServerCli.h"
#include "Tesselator.h"
@ -68,6 +69,15 @@ static volatile bool g_shutdownRequested = false;
static const DWORD kDefaultAutosaveIntervalMs = 60 * 1000;
static const int kServerActionPad = 0;
namespace ServerRuntime
{
void RequestDedicatedServerShutdown()
{
g_shutdownRequested = true;
app.m_bShutdown = true;
}
}
/**
* Calls Access::Shutdown automatically once dedicated access control was initialized successfully
* Shutdownを自動化する
@ -104,8 +114,7 @@ static BOOL WINAPI ConsoleCtrlHandlerProc(DWORD ctrlType)
case CTRL_BREAK_EVENT:
case CTRL_CLOSE_EVENT:
case CTRL_SHUTDOWN_EVENT:
g_shutdownRequested = true;
app.m_bShutdown = true;
ServerRuntime::RequestDedicatedServerShutdown();
return TRUE;
default:
return FALSE;