@@ -3396,10 +3396,6 @@ v3f Server::findSpawnPos()
3396
3396
3397
3397
void Server::requestShutdown (const std::string &msg, bool reconnect, float delay)
3398
3398
{
3399
- m_shutdown_timer = delay;
3400
- m_shutdown_msg = msg;
3401
- m_shutdown_ask_reconnect = reconnect;
3402
-
3403
3399
if (delay == 0 .0f ) {
3404
3400
// No delay, shutdown immediately
3405
3401
m_shutdown_requested = true ;
@@ -3418,17 +3414,23 @@ void Server::requestShutdown(const std::string &msg, bool reconnect, float delay
3418
3414
3419
3415
infostream << wide_to_utf8 (ws.str ()).c_str () << std::endl;
3420
3416
SendChatMessage (PEER_ID_INEXISTENT, ws.str ());
3417
+ // m_shutdown_* are already handled, skip.
3418
+ return ;
3421
3419
} else if (delay > 0 .0f ) {
3422
3420
// Positive delay, tell the clients when the server will shut down
3423
3421
std::wstringstream ws;
3424
3422
3425
3423
ws << L" *** Server shutting down in "
3426
- << duration_to_string (myround (m_shutdown_timer )).c_str ()
3424
+ << duration_to_string (myround (delay )).c_str ()
3427
3425
<< " ." ;
3428
3426
3429
3427
infostream << wide_to_utf8 (ws.str ()).c_str () << std::endl;
3430
3428
SendChatMessage (PEER_ID_INEXISTENT, ws.str ());
3431
3429
}
3430
+
3431
+ m_shutdown_timer = delay;
3432
+ m_shutdown_msg = msg;
3433
+ m_shutdown_ask_reconnect = reconnect;
3432
3434
}
3433
3435
3434
3436
PlayerSAO* Server::emergePlayer (const char *name, session_t peer_id, u16 proto_version)
0 commit comments