From 7c824f02b445579c0ef54a2212f851ae811a639d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 28 Jan 2012 22:19:10 +0100 Subject: Add the ability to abort a pending restart using the viewer UI or a RemoteAdmin message --- .../RemoteController/RemoteAdminPlugin.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'OpenSim/ApplicationPlugins/RemoteController') diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index dcc88c4..914e4d6 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -263,6 +263,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController Scene rebootedScene = null; GetSceneFromRegionParams(requestData, responseData, out rebootedScene); + IRestartModule restartModule = rebootedScene.RequestModuleInterface(); + responseData["success"] = false; responseData["accepted"] = true; responseData["rebooting"] = true; @@ -273,6 +275,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController if (requestData.ContainsKey("alerts")) { string[] alertTimes = requestData["alerts"].ToString().Split( new char[] {','}); + if (alertTimes.Length == 1 && Convert.ToInt32(alertTimes[0]) == -1) + { + if (restartModule != null) + { + message = "Restart has been cancelled"; + + if (requestData.ContainsKey("message")) + message = requestData["message"].ToString(); + + restartModule.AbortRestart(message); + + responseData["success"] = true; + responseData["rebooting"] = false; + + return; + } + } foreach (string a in alertTimes) times.Add(Convert.ToInt32(a)); } @@ -305,7 +324,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController notice = false; } - IRestartModule restartModule = rebootedScene.RequestModuleInterface(); if (restartModule != null) { restartModule.ScheduleRestart(UUID.Zero, message, times.ToArray(), notice); -- cgit v1.1