diff options
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 74 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 16 |
2 files changed, 86 insertions, 4 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 3bc557d..325816d 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -213,9 +213,59 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
213 | if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene)) | 213 | if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene)) |
214 | throw new Exception("region not found"); | 214 | throw new Exception("region not found"); |
215 | 215 | ||
216 | int timeout = 30000; | ||
217 | string message; | ||
218 | |||
219 | if (requestData.ContainsKey("restart") | ||
220 | && ((string)requestData["restart"] == "delayed") | ||
221 | && requestData.ContainsKey("milliseconds")) | ||
222 | { | ||
223 | timeout = Int32.Parse(requestData["milliseconds"].ToString()); | ||
224 | |||
225 | if (timeout < 15000) | ||
226 | { | ||
227 | //It must be at least 15 seconds or we'll cancel the reboot request | ||
228 | timeout = 15000; | ||
229 | } | ||
230 | |||
231 | message | ||
232 | = "Region is restarting in " + ((int)(timeout / 1000)).ToString() | ||
233 | + " second(s). Please save what you are doing and log out."; | ||
234 | } | ||
235 | else | ||
236 | { | ||
237 | message = "Region is restarting in 30 second(s). Please save what you are doing and log out."; | ||
238 | } | ||
239 | |||
240 | if (requestData.ContainsKey("noticetype") | ||
241 | && ((string)requestData["noticetype"] == "dialog")) | ||
242 | { | ||
243 | m_app.SceneManager.ForEachScene( | ||
244 | delegate(Scene scene) | ||
245 | { | ||
246 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
247 | if (dialogModule != null) | ||
248 | dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message); | ||
249 | }); | ||
250 | } | ||
251 | else | ||
252 | { | ||
253 | if (!requestData.ContainsKey("noticetype") | ||
254 | || ((string)requestData["noticetype"] != "none")) | ||
255 | { | ||
256 | m_app.SceneManager.ForEachScene( | ||
257 | delegate(Scene scene) | ||
258 | { | ||
259 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
260 | if (dialogModule != null) | ||
261 | dialogModule.SendGeneralAlert(message); | ||
262 | }); | ||
263 | } | ||
264 | } | ||
265 | |||
216 | responseData["rebooting"] = true; | 266 | responseData["rebooting"] = true; |
217 | response.Value = responseData; | 267 | response.Value = responseData; |
218 | rebootedScene.Restart(30); | 268 | rebootedScene.Restart(timeout / 1000,false); |
219 | } | 269 | } |
220 | catch (Exception e) | 270 | catch (Exception e) |
221 | { | 271 | { |
@@ -419,13 +469,33 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
419 | message = "Region is going down now."; | 469 | message = "Region is going down now."; |
420 | } | 470 | } |
421 | 471 | ||
422 | m_app.SceneManager.ForEachScene( | 472 | if (requestData.ContainsKey("noticetype") |
473 | && ((string) requestData["noticetype"] == "dialog")) | ||
474 | { | ||
475 | m_app.SceneManager.ForEachScene( | ||
423 | delegate(Scene scene) | 476 | delegate(Scene scene) |
424 | { | 477 | { |
425 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | 478 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); |
426 | if (dialogModule != null) | 479 | if (dialogModule != null) |
480 | dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message); | ||
481 | }); | ||
482 | } | ||
483 | else | ||
484 | { | ||
485 | if (!requestData.ContainsKey("noticetype") | ||
486 | || ((string)requestData["noticetype"] != "none")) | ||
487 | { | ||
488 | m_app.SceneManager.ForEachScene( | ||
489 | delegate(Scene scene) | ||
490 | { | ||
491 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
492 | if (dialogModule != null) | ||
427 | dialogModule.SendGeneralAlert(message); | 493 | dialogModule.SendGeneralAlert(message); |
428 | }); | 494 | }); |
495 | } | ||
496 | } | ||
497 | |||
498 | |||
429 | 499 | ||
430 | // Perform shutdown | 500 | // Perform shutdown |
431 | System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing | 501 | System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4ffa1a2..be1d4bf 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -873,6 +873,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
873 | /// <param name="seconds">float indicating duration before restart.</param> | 873 | /// <param name="seconds">float indicating duration before restart.</param> |
874 | public virtual void Restart(float seconds) | 874 | public virtual void Restart(float seconds) |
875 | { | 875 | { |
876 | Restart(seconds, true); | ||
877 | } | ||
878 | |||
879 | /// <summary> | ||
880 | /// Given float seconds, this will restart the region. showDialog will optionally alert the users. | ||
881 | /// </summary> | ||
882 | /// <param name="seconds">float indicating duration before restart.</param> | ||
883 | public virtual void Restart(float seconds, bool showDialog) | ||
884 | { | ||
876 | // notifications are done in 15 second increments | 885 | // notifications are done in 15 second increments |
877 | // so .. if the number of seconds is less then 15 seconds, it's not really a restart request | 886 | // so .. if the number of seconds is less then 15 seconds, it's not really a restart request |
878 | // It's a 'Cancel restart' request. | 887 | // It's a 'Cancel restart' request. |
@@ -893,8 +902,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
893 | m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); | 902 | m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); |
894 | m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); | 903 | m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); |
895 | m_restartTimer.Start(); | 904 | m_restartTimer.Start(); |
896 | m_dialogModule.SendNotificationToUsersInRegion( | 905 | if (showDialog) |
897 | UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in 2 Minutes"); | 906 | { |
907 | m_dialogModule.SendNotificationToUsersInRegion( | ||
908 | UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in " + (seconds / 60).ToString() + " Minutes"); | ||
909 | } | ||
898 | } | 910 | } |
899 | } | 911 | } |
900 | 912 | ||