aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-05-07 16:24:15 +0000
committerJustin Clarke Casey2008-05-07 16:24:15 +0000
commit250fb6f5dbcd6665c2783db08389b7e5ce698d5e (patch)
treece50e5ed7f0709cd2f819ad3c4eca63338407463
parentThank you very much, Xantor for a patch to improve (diff)
downloadopensim-SC-250fb6f5dbcd6665c2783db08389b7e5ce698d5e.zip
opensim-SC-250fb6f5dbcd6665c2783db08389b7e5ce698d5e.tar.gz
opensim-SC-250fb6f5dbcd6665c2783db08389b7e5ce698d5e.tar.bz2
opensim-SC-250fb6f5dbcd6665c2783db08389b7e5ce698d5e.tar.xz
* Move shutdown processing to base OpenSimServer, overriding the method where appropriate
* This also means that the command quit (as well as shutdown) will now close down grid servers (instead of only being in place for the region server)
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs18
-rw-r--r--OpenSim/Grid/AssetServer/Main.cs4
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs21
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs4
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs24
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServerMain.cs4
-rw-r--r--OpenSim/Grid/UserServer/Main.cs16
-rw-r--r--OpenSim/Region/Application/OpenSimMainConsole.cs26
8 files changed, 50 insertions, 67 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index c243042..2069c0e 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -47,7 +47,16 @@ namespace OpenSim.Framework.Servers
47 public BaseOpenSimServer() 47 public BaseOpenSimServer()
48 { 48 {
49 m_startuptime = DateTime.Now; 49 m_startuptime = DateTime.Now;
50 } 50 }
51
52 /// <summary>
53 /// Should be overriden by descendents if they need to perform extra shutdown processing
54 /// </summary>
55 protected virtual void Shutdown()
56 {
57 m_console.Close();
58 Environment.Exit(0);
59 }
51 60
52 /// <summary> 61 /// <summary>
53 /// Runs commands issued by the server console from the operator 62 /// Runs commands issued by the server console from the operator
@@ -59,7 +68,9 @@ namespace OpenSim.Framework.Servers
59 switch (command) 68 switch (command)
60 { 69 {
61 case "help": 70 case "help":
71 m_console.Notice("quit - equivalent to shutdown.");
62 m_console.Notice("show uptime - show server startup and uptime."); 72 m_console.Notice("show uptime - show server startup and uptime.");
73 m_console.Notice("shutdown - shutdown the server.\n");
63 break; 74 break;
64 75
65 case "show": 76 case "show":
@@ -68,6 +79,11 @@ namespace OpenSim.Framework.Servers
68 Show(cmdparams[0]); 79 Show(cmdparams[0]);
69 } 80 }
70 break; 81 break;
82
83 case "quit":
84 case "shutdown":
85 Shutdown();
86 break;
71 } 87 }
72 } 88 }
73 89
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index 26f4bc8..77e4628 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -181,9 +181,7 @@ namespace OpenSim.Grid.AssetServer
181 switch (cmd) 181 switch (cmd)
182 { 182 {
183 case "help": 183 case "help":
184 m_console.Notice( 184 m_console.Notice("stats - statistical information for this server");
185 @"shutdown - shutdown this asset server (USE CAUTION!)
186 stats - statistical information for this server");
187 185
188 break; 186 break;
189 187
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 2feaac3..49c53e9 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -177,23 +177,12 @@ namespace OpenSim.Grid.GridServer
177 } 177 }
178 */ 178 */
179 } 179 }
180 180
181 public override void RunCmd(string cmd, string[] cmdparams) 181 protected override void Shutdown()
182 { 182 {
183 base.RunCmd(cmd, cmdparams); 183 foreach (IGridPlugin plugin in m_plugins) plugin.Close();
184 184
185 switch (cmd) 185 base.Shutdown();
186 {
187 case "help":
188 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
189 break;
190
191 case "shutdown":
192 foreach (IGridPlugin plugin in m_plugins) plugin.Close();
193 m_console.Close();
194 Environment.Exit(0);
195 break;
196 }
197 } 186 }
198 } 187 }
199} 188}
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index 4076d21..f1bd60f 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -144,10 +144,6 @@ namespace OpenSim.Grid.InventoryServer
144 case "add-user": 144 case "add-user":
145 m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID); 145 m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID);
146 break; 146 break;
147 case "shutdown":
148 m_console.Close();
149 Environment.Exit(0);
150 break;
151 } 147 }
152 } 148 }
153 } 149 }
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index bf793bf..22a7d9c 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -140,29 +140,13 @@ namespace OpenSim.Grid.MessagingServer
140 // m_lastCreatedUser = userID; 140 // m_lastCreatedUser = userID;
141 break; 141 break;
142 } 142 }
143 } 143 }
144 144
145 public override void RunCmd(string cmd, string[] cmdparams) 145 protected override void Shutdown()
146 { 146 {
147 base.RunCmd(cmd, cmdparams); 147 msgsvc.deregisterWithUserServer();
148 148
149 switch (cmd) 149 base.Shutdown();
150 {
151 case "help":
152 m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)");
153 break;
154
155 case "shutdown":
156 msgsvc.deregisterWithUserServer();
157 m_console.Close();
158 Environment.Exit(0);
159 break;
160 }
161 }
162
163 public override void Show(string ShowWhat)
164 {
165 base.Show(ShowWhat);
166 } 150 }
167 } 151 }
168} 152}
diff --git a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs
index 528b51c..e487c02 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs
@@ -97,10 +97,6 @@ namespace OpenSim.Grid.ScriptServer
97 } 97 }
98 } 98 }
99 99
100 ~ScriptServerMain()
101 {
102 }
103
104 protected ConsoleBase CreateConsole() 100 protected ConsoleBase CreateConsole()
105 { 101 {
106 return new ConsoleBase("ScriptServer", this); 102 return new ConsoleBase("ScriptServer", this);
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 8e6559c..d60c205 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -219,19 +219,12 @@ namespace OpenSim.Grid.UserServer
219 { 219 {
220 case "help": 220 case "help":
221 m_console.Notice("create user - create a new user"); 221 m_console.Notice("create user - create a new user");
222 m_console.Notice("stats - statistical information for this server"); 222 m_console.Notice("stats - statistical information for this server");
223 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
224 break; 223 break;
225 224
226 case "create": 225 case "create":
227 do_create(cmdparams[0]); 226 do_create(cmdparams[0]);
228 break; 227 break;
229
230 case "shutdown":
231 m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
232 m_console.Close();
233 Environment.Exit(0);
234 break;
235 228
236 case "stats": 229 case "stats":
237 m_console.Notice(StatsManager.UserStats.Report()); 230 m_console.Notice(StatsManager.UserStats.Report());
@@ -251,6 +244,13 @@ namespace OpenSim.Grid.UserServer
251 } 244 }
252 } 245 }
253 246
247 protected override void Shutdown()
248 {
249 m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
250
251 base.Shutdown();
252 }
253
254 public void TestResponse(List<InventoryFolderBase> resp) 254 public void TestResponse(List<InventoryFolderBase> resp)
255 { 255 {
256 m_console.Notice("response got"); 256 m_console.Notice("response got");
diff --git a/OpenSim/Region/Application/OpenSimMainConsole.cs b/OpenSim/Region/Application/OpenSimMainConsole.cs
index 38cae66..b213ed2 100644
--- a/OpenSim/Region/Application/OpenSimMainConsole.cs
+++ b/OpenSim/Region/Application/OpenSimMainConsole.cs
@@ -129,9 +129,21 @@ namespace OpenSim
129 { 129 {
130 RunCommandScript(m_shutdownCommandsFile); 130 RunCommandScript(m_shutdownCommandsFile);
131 } 131 }
132 InternalShutdown(); 132
133 m_console.Close(); 133 if (proxyUrl.Length > 0)
134 Environment.Exit(0); 134 {
135 Util.XmlRpcCommand(proxyUrl, "Stop");
136 }
137
138 m_log.Info("[SHUTDOWN]: Closing all threads");
139 m_log.Info("[SHUTDOWN]: Killing listener thread");
140 m_log.Info("[SHUTDOWN]: Killing clients");
141 // TODO: implement this
142 m_log.Info("[SHUTDOWN]: Closing console and terminating");
143
144 m_sceneManager.Close();
145
146 base.Shutdown();
135 } 147 }
136 148
137 private void RunAutoTimerScript(object sender, EventArgs e) 149 private void RunAutoTimerScript(object sender, EventArgs e)
@@ -259,7 +271,6 @@ namespace OpenSim
259 m_console.Notice("load-xml [filename] - load prims from XML"); 271 m_console.Notice("load-xml [filename] - load prims from XML");
260 m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format"); 272 m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format");
261 m_console.Notice("permissions [true/false] - turn on/off permissions on the scene"); 273 m_console.Notice("permissions [true/false] - turn on/off permissions on the scene");
262 m_console.Notice("quit - equivalent to shutdown.");
263 m_console.Notice("restart - disconnects all clients and restarts the sims in the instance."); 274 m_console.Notice("restart - disconnects all clients and restarts the sims in the instance.");
264 m_console.Notice("remove-region [name] - remove a region"); 275 m_console.Notice("remove-region [name] - remove a region");
265 m_console.Notice("save-xml [filename] - save prims to XML"); 276 m_console.Notice("save-xml [filename] - save prims to XML");
@@ -271,7 +282,6 @@ namespace OpenSim
271 m_console.Notice("show modules - shows info about loaded modules."); 282 m_console.Notice("show modules - shows info about loaded modules.");
272 m_console.Notice("show stats - statistical information for this server not displayed in the client"); 283 m_console.Notice("show stats - statistical information for this server not displayed in the client");
273 m_console.Notice("threads - list threads"); 284 m_console.Notice("threads - list threads");
274 m_console.Notice("shutdown - disconnect all clients and shutdown.");
275 m_console.Notice("config set section field value - set a config value"); 285 m_console.Notice("config set section field value - set a config value");
276 m_console.Notice("config get section field - get a config value"); 286 m_console.Notice("config get section field - get a config value");
277 m_console.Notice("config save - save OpenSim.ini"); 287 m_console.Notice("config save - save OpenSim.ini");
@@ -422,12 +432,6 @@ namespace OpenSim
422 } 432 }
423 break; 433 break;
424 434
425 case "exit":
426 case "quit":
427 case "shutdown":
428 Shutdown();
429 break;
430
431 case "restart": 435 case "restart":
432 m_sceneManager.RestartCurrentScene(); 436 m_sceneManager.RestartCurrentScene();
433 break; 437 break;