aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-04-21 19:31:59 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-04-21 19:31:59 +0200
commitf151b2322003bbc89c2cd3c603ef1e1ab9d46439 (patch)
tree7662fc8c680fa65fdab07217f598637dd3ca38b2 /src
parent900b816162401a6d9006334e2e8e8a9a26a1613b (diff)
downloadminetest-f151b2322003bbc89c2cd3c603ef1e1ab9d46439.tar.gz
minetest-f151b2322003bbc89c2cd3c603ef1e1ab9d46439.tar.bz2
minetest-f151b2322003bbc89c2cd3c603ef1e1ab9d46439.zip
Fix #5617 - respect message and reconnect parameters when shutting down immediately (#5621)
Diffstat (limited to 'src')
-rw-r--r--src/server.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/server.cpp b/src/server.cpp
index a9e5c3d08..a921423d2 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -3479,9 +3479,16 @@ 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;
+ // only print to the infostream, a chat message saying
+ // "Server Shutting Down" is sent when the server destructs.
+ infostream << "*** Immediate Server shutdown requested." << std::endl;
} else if (delay < 0.0f && m_shutdown_timer > 0.0f) {
// Negative delay, cancel shutdown if requested
m_shutdown_timer = 0.0f;
@@ -3495,10 +3502,7 @@ 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());
} else if (delay > 0.0f) {
- // Positive delay, delay the shutdown
- m_shutdown_timer = delay;
- m_shutdown_msg = msg;
- m_shutdown_ask_reconnect = reconnect;
+ // Positive delay, tell the clients when the server will shut down
std::wstringstream ws;
ws << L"*** Server shutting down in "