mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
fix: fix stop command shutdown process
add dedicated server shutdown request handling
This commit is contained in:
parent
8b68b81ffa
commit
590241c5ef
|
|
@ -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
|
||||
|
|
|
|||
6
Minecraft.Server/ServerShutdown.h
Normal file
6
Minecraft.Server/ServerShutdown.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
namespace ServerRuntime
|
||||
{
|
||||
void RequestDedicatedServerShutdown();
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue