diff --git a/changelog b/changelog index f4450721966..aa36b9b2da3 100644 --- a/changelog +++ b/changelog @@ -30,6 +30,7 @@ Version 1.5.0+svn: * Implemented the option to use the mouse selection clipboard in X11 the new widget library also uses it. * added restart command to server that does gracefull restart + * added option to do gracefull shut down for server * fixed multiplayer_connect to handle leave_game command from server * Removed bug introduced in 1.5.0 that allowed use of :debug commands during network play diff --git a/src/server/server.cpp b/src/server/server.cpp index 6614b287ea6..1fb610bb1fc 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -875,9 +875,21 @@ std::string server::process_command(const std::string& query) { const std::string& help_msg = "Available commands are: ban(s) [] []," "kick , k(ick)ban [] [], help, metrics, netstats," " (lobby)msg , motd [], status []," - " unban "; + " unban , shut_down [now], restart"; if (command == "shut_down") { - throw network::error("shut down"); + + if (parameter == "now") + throw network::error("shut down"); + else + { + // Gracefull shut down + server_.stop(); + input_.stop(); + gracefull_restart = true; + process_command("msg Server is shuting down. No more new games."); + out << "Server is doing gracefull shutdown\n"; + } + #ifndef _WIN32 // Not sure if this works on windows // TODO: check if this works in windows. } else if (command == "restart") {