added option to do graceful shut down for server

This commit is contained in:
Pauli Nieminen 2008-05-08 12:58:31 +00:00
parent 14d199adbc
commit 6b589ee48e
2 changed files with 15 additions and 2 deletions

View file

@ -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

View file

@ -875,9 +875,21 @@ std::string server::process_command(const std::string& query) {
const std::string& help_msg = "Available commands are: ban(s) [<mask>] [<reason>],"
"kick <mask>, k(ick)ban [<mask>] [<reason>], help, metrics, netstats,"
" (lobby)msg <message>, motd [<message>], status [<mask>],"
" unban <ipmask>";
" unban <ipmask>, 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") {