diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index c243042138..2069c0e15c 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -47,7 +47,16 @@ namespace OpenSim.Framework.Servers public BaseOpenSimServer() { m_startuptime = DateTime.Now; - } + } + + /// + /// Should be overriden by descendents if they need to perform extra shutdown processing + /// + protected virtual void Shutdown() + { + m_console.Close(); + Environment.Exit(0); + } /// /// Runs commands issued by the server console from the operator @@ -59,7 +68,9 @@ namespace OpenSim.Framework.Servers switch (command) { case "help": + m_console.Notice("quit - equivalent to shutdown."); m_console.Notice("show uptime - show server startup and uptime."); + m_console.Notice("shutdown - shutdown the server.\n"); break; case "show": @@ -68,6 +79,11 @@ namespace OpenSim.Framework.Servers Show(cmdparams[0]); } break; + + case "quit": + case "shutdown": + Shutdown(); + break; } } diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index 26f4bc8c42..77e462826a 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs @@ -181,9 +181,7 @@ namespace OpenSim.Grid.AssetServer switch (cmd) { case "help": - m_console.Notice( - @"shutdown - shutdown this asset server (USE CAUTION!) - stats - statistical information for this server"); + m_console.Notice("stats - statistical information for this server"); break; diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index 2feaac37fb..49c53e9726 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -177,23 +177,12 @@ namespace OpenSim.Grid.GridServer } */ } - - public override void RunCmd(string cmd, string[] cmdparams) + + protected override void Shutdown() { - base.RunCmd(cmd, cmdparams); - - switch (cmd) - { - case "help": - m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); - break; - - case "shutdown": - foreach (IGridPlugin plugin in m_plugins) plugin.Close(); - m_console.Close(); - Environment.Exit(0); - break; - } + foreach (IGridPlugin plugin in m_plugins) plugin.Close(); + + base.Shutdown(); } } } diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index 4076d2146b..f1bd60f5f4 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs @@ -144,10 +144,6 @@ namespace OpenSim.Grid.InventoryServer case "add-user": m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID); break; - case "shutdown": - m_console.Close(); - Environment.Exit(0); - break; } } } diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index bf793bf1bc..22a7d9c6da 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs @@ -140,29 +140,13 @@ namespace OpenSim.Grid.MessagingServer // m_lastCreatedUser = userID; break; } - } + } - public override void RunCmd(string cmd, string[] cmdparams) + protected override void Shutdown() { - base.RunCmd(cmd, cmdparams); + msgsvc.deregisterWithUserServer(); - switch (cmd) - { - case "help": - m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)"); - break; - - case "shutdown": - msgsvc.deregisterWithUserServer(); - m_console.Close(); - Environment.Exit(0); - break; - } - } - - public override void Show(string ShowWhat) - { - base.Show(ShowWhat); + base.Shutdown(); } } } diff --git a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs index 528b51c2d6..e487c02e76 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs @@ -97,10 +97,6 @@ namespace OpenSim.Grid.ScriptServer } } - ~ScriptServerMain() - { - } - protected ConsoleBase CreateConsole() { return new ConsoleBase("ScriptServer", this); diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 8e6559c62d..d60c205b18 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -219,19 +219,12 @@ namespace OpenSim.Grid.UserServer { case "help": m_console.Notice("create user - create a new user"); - m_console.Notice("stats - statistical information for this server"); - m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); + m_console.Notice("stats - statistical information for this server"); break; case "create": do_create(cmdparams[0]); break; - - case "shutdown": - m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; - m_console.Close(); - Environment.Exit(0); - break; case "stats": m_console.Notice(StatsManager.UserStats.Report()); @@ -251,6 +244,13 @@ namespace OpenSim.Grid.UserServer } } + protected override void Shutdown() + { + m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; + + base.Shutdown(); + } + public void TestResponse(List resp) { m_console.Notice("response got"); diff --git a/OpenSim/Region/Application/OpenSimMainConsole.cs b/OpenSim/Region/Application/OpenSimMainConsole.cs index 38cae66785..b213ed213f 100644 --- a/OpenSim/Region/Application/OpenSimMainConsole.cs +++ b/OpenSim/Region/Application/OpenSimMainConsole.cs @@ -129,9 +129,21 @@ namespace OpenSim { RunCommandScript(m_shutdownCommandsFile); } - InternalShutdown(); - m_console.Close(); - Environment.Exit(0); + + if (proxyUrl.Length > 0) + { + Util.XmlRpcCommand(proxyUrl, "Stop"); + } + + m_log.Info("[SHUTDOWN]: Closing all threads"); + m_log.Info("[SHUTDOWN]: Killing listener thread"); + m_log.Info("[SHUTDOWN]: Killing clients"); + // TODO: implement this + m_log.Info("[SHUTDOWN]: Closing console and terminating"); + + m_sceneManager.Close(); + + base.Shutdown(); } private void RunAutoTimerScript(object sender, EventArgs e) @@ -259,7 +271,6 @@ namespace OpenSim m_console.Notice("load-xml [filename] - load prims from XML"); m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format"); m_console.Notice("permissions [true/false] - turn on/off permissions on the scene"); - m_console.Notice("quit - equivalent to shutdown."); m_console.Notice("restart - disconnects all clients and restarts the sims in the instance."); m_console.Notice("remove-region [name] - remove a region"); m_console.Notice("save-xml [filename] - save prims to XML"); @@ -271,7 +282,6 @@ namespace OpenSim m_console.Notice("show modules - shows info about loaded modules."); m_console.Notice("show stats - statistical information for this server not displayed in the client"); m_console.Notice("threads - list threads"); - m_console.Notice("shutdown - disconnect all clients and shutdown."); m_console.Notice("config set section field value - set a config value"); m_console.Notice("config get section field - get a config value"); m_console.Notice("config save - save OpenSim.ini"); @@ -422,12 +432,6 @@ namespace OpenSim } break; - case "exit": - case "quit": - case "shutdown": - Shutdown(); - break; - case "restart": m_sceneManager.RestartCurrentScene(); break;