diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2018-06-11 13:43:12 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-06-11 13:43:12 +0200 |
commit | 409d04324f0a81eaa78ff9161b4f3593d89151c5 (patch) | |
tree | cdd5f688a639ce3eb34dde450173989907e52c94 /src | |
parent | fb4e4f048ea8c53d20465ee17fddbfc0ae946b74 (diff) | |
download | minetest-409d04324f0a81eaa78ff9161b4f3593d89151c5.tar.gz minetest-409d04324f0a81eaa78ff9161b4f3593d89151c5.tar.bz2 minetest-409d04324f0a81eaa78ff9161b4f3593d89151c5.zip |
Fix the /shutdown command (#7431)
Diffstat (limited to 'src')
-rw-r--r-- | src/server.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/server.cpp b/src/server.cpp index d47b4ecd0..13a3b4552 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3396,10 +3396,6 @@ v3f Server::findSpawnPos() void Server::requestShutdown(const std::string &msg, bool reconnect, float delay) { - m_shutdown_timer = delay; - m_shutdown_msg = msg; - m_shutdown_ask_reconnect = reconnect; - if (delay == 0.0f) { // No delay, shutdown immediately m_shutdown_requested = true; @@ -3418,17 +3414,23 @@ void Server::requestShutdown(const std::string &msg, bool reconnect, float delay infostream << wide_to_utf8(ws.str()).c_str() << std::endl; SendChatMessage(PEER_ID_INEXISTENT, ws.str()); + // m_shutdown_* are already handled, skip. + return; } else if (delay > 0.0f) { // Positive delay, tell the clients when the server will shut down std::wstringstream ws; ws << L"*** Server shutting down in " - << duration_to_string(myround(m_shutdown_timer)).c_str() + << duration_to_string(myround(delay)).c_str() << "."; infostream << wide_to_utf8(ws.str()).c_str() << std::endl; SendChatMessage(PEER_ID_INEXISTENT, ws.str()); } + + m_shutdown_timer = delay; + m_shutdown_msg = msg; + m_shutdown_ask_reconnect = reconnect; } PlayerSAO* Server::emergePlayer(const char *name, session_t peer_id, u16 proto_version) |