aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs59
-rw-r--r--OpenSim/Framework/IScene.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs69
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs25
6 files changed, 67 insertions, 126 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 7b931d7..7be152b 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -209,68 +209,43 @@ namespace OpenSim.ApplicationPlugins.RemoteController
209 209
210 UUID regionID = new UUID((string) requestData["regionID"]); 210 UUID regionID = new UUID((string) requestData["regionID"]);
211 211
212 responseData["accepted"] = true;
213 responseData["success"] = true;
214 response.Value = responseData;
215
216 Scene rebootedScene; 212 Scene rebootedScene;
217 213
214 responseData["success"] = false;
215 responseData["accepted"] = true;
218 if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene)) 216 if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene))
219 throw new Exception("region not found"); 217 throw new Exception("region not found");
220 218
221 int timeout = 30000; 219 int timeout = 30;
222 string message; 220 string message;
223 221
224 if (requestData.ContainsKey("restart") 222 if (requestData.ContainsKey("restart")
225 && ((string)requestData["restart"] == "delayed") 223 && ((string)requestData["restart"] == "delayed")
226 && requestData.ContainsKey("milliseconds")) 224 && requestData.ContainsKey("milliseconds"))
227 { 225 {
228 timeout = Int32.Parse(requestData["milliseconds"].ToString()); 226 timeout = Int32.Parse(requestData["milliseconds"].ToString()) / 1000;
229
230 if (timeout < 15000)
231 {
232 //It must be at least 15 seconds or we'll cancel the reboot request
233 timeout = 15000;
234 }
235
236 message
237 = "Region is restarting in " + ((int)(timeout / 1000)).ToString()
238 + " second(s). Please save what you are doing and log out.";
239 }
240 else
241 {
242 message = "Region is restarting in 30 second(s). Please save what you are doing and log out.";
243 } 227 }
244 228
229 message = "Region is restarting in {0}. Please save what you are doing and log out.";
230
231 bool notice = true;
245 if (requestData.ContainsKey("noticetype") 232 if (requestData.ContainsKey("noticetype")
246 && ((string)requestData["noticetype"] == "dialog")) 233 && ((string)requestData["noticetype"] == "dialog"))
247 { 234 {
248 m_application.SceneManager.ForEachScene( 235 notice = false;
249 delegate(Scene scene)
250 {
251 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
252 if (dialogModule != null)
253 dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message);
254 });
255 }
256 else
257 {
258 if (!requestData.ContainsKey("noticetype")
259 || ((string)requestData["noticetype"] != "none"))
260 {
261 m_application.SceneManager.ForEachScene(
262 delegate(Scene scene)
263 {
264 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
265 if (dialogModule != null)
266 dialogModule.SendGeneralAlert(message);
267 });
268 }
269 } 236 }
270 237
271 responseData["rebooting"] = true; 238 responseData["rebooting"] = true;
239
240 IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>();
241 if (restartModule != null)
242 {
243 List<int> times = new List<int> { 30, 15 };
244
245 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), notice);
246 responseData["success"] = true;
247 }
272 response.Value = responseData; 248 response.Value = responseData;
273 rebootedScene.Restart(timeout / 1000,false);
274 } 249 }
275 catch (Exception e) 250 catch (Exception e)
276 { 251 {
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index 6798b7b..1298f26 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Framework
73 void AddNewClient(IClientAPI client); 73 void AddNewClient(IClientAPI client);
74 void RemoveClient(UUID agentID); 74 void RemoveClient(UUID agentID);
75 75
76 void Restart(int seconds); 76 void Restart();
77 //RegionInfo OtherRegionUp(RegionInfo thisRegion); 77 //RegionInfo OtherRegionUp(RegionInfo thisRegion);
78 78
79 string GetSimulatorVersion(); 79 string GetSimulatorVersion();
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 14de4f4..75cf0c6 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -233,7 +233,23 @@ namespace OpenSim.Region.CoreModules.World.Estate
233 233
234 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) 234 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
235 { 235 {
236 m_scene.Restart(timeInSeconds); 236 IRestartModule restartModule = m_scene.RequestModuleInterface<IRestartModule>();
237 if (restartModule != null)
238 {
239 List<int> times = new List<int>();
240 while (timeInSeconds > 0)
241 {
242 times.Add(timeInSeconds);
243 if (timeInSeconds > 300)
244 timeInSeconds -= 120;
245 else if (timeInSeconds > 30)
246 timeInSeconds -= 30;
247 else
248 timeInSeconds -= 15;
249 }
250
251 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
252 }
237 } 253 }
238 254
239 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID) 255 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d3a4678..e479628 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -915,72 +915,6 @@ namespace OpenSim.Region.Framework.Scenes
915 return new GridRegion(RegionInfo); 915 return new GridRegion(RegionInfo);
916 } 916 }
917 917
918 /// <summary>
919 /// Given float seconds, this will restart the region.
920 /// </summary>
921 /// <param name="seconds">float indicating duration before restart.</param>
922 public virtual void Restart(float seconds)
923 {
924 Restart(seconds, true);
925 }
926
927 /// <summary>
928 /// Given float seconds, this will restart the region. showDialog will optionally alert the users.
929 /// </summary>
930 /// <param name="seconds">float indicating duration before restart.</param>
931 public virtual void Restart(float seconds, bool showDialog)
932 {
933 // notifications are done in 15 second increments
934 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request
935 // It's a 'Cancel restart' request.
936
937 // RestartNow() does immediate restarting.
938 if (seconds < 15)
939 {
940 m_restartTimer.Stop();
941 m_dialogModule.SendGeneralAlert("Restart Aborted");
942 }
943 else
944 {
945 // Now we figure out what to set the timer to that does the notifications and calls, RestartNow()
946 m_restartTimer.Interval = 15000;
947 m_incrementsof15seconds = (int)seconds / 15;
948 m_RestartTimerCounter = 0;
949 m_restartTimer.AutoReset = true;
950 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
951 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
952 m_restartTimer.Start();
953 if (showDialog)
954 {
955 m_dialogModule.SendNotificationToUsersInRegion(
956 UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0)));
957 }
958 }
959 }
960
961 // The Restart timer has occured.
962 // We have to figure out if this is a notification or if the number of seconds specified in Restart
963 // have elapsed.
964 // If they have elapsed, call RestartNow()
965 public void RestartTimer_Elapsed(object sender, ElapsedEventArgs e)
966 {
967 m_RestartTimerCounter++;
968 if (m_RestartTimerCounter <= m_incrementsof15seconds)
969 {
970 if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7)
971 m_dialogModule.SendNotificationToUsersInRegion(
972 UUID.Random(),
973 String.Empty,
974 RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter) * 15) + " seconds");
975 }
976 else
977 {
978 m_restartTimer.Stop();
979 m_restartTimer.AutoReset = false;
980 RestartNow();
981 }
982 }
983
984 // This causes the region to restart immediatley. 918 // This causes the region to restart immediatley.
985 public void RestartNow() 919 public void RestartNow()
986 { 920 {
@@ -1003,7 +937,8 @@ namespace OpenSim.Region.Framework.Scenes
1003 Close(); 937 Close();
1004 938
1005 m_log.Error("[REGION]: Firing Region Restart Message"); 939 m_log.Error("[REGION]: Firing Region Restart Message");
1006 base.Restart(0); 940
941 base.Restart();
1007 } 942 }
1008 943
1009 // This is a helper function that notifies root agents in this region that a new sim near them has come up 944 // This is a helper function that notifies root agents in this region that a new sim near them has come up
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index c71aefa..f343bc8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -218,18 +218,6 @@ namespace OpenSim.Region.Framework.Scenes
218 218
219 #region admin stuff 219 #region admin stuff
220 220
221 /// <summary>
222 /// Region Restart - Seconds till restart.
223 /// </summary>
224 /// <param name="seconds"></param>
225 public virtual void Restart(int seconds)
226 {
227 m_log.Error("[REGION]: passing Restart Message up the namespace");
228 restart handlerPhysicsCrash = OnRestart;
229 if (handlerPhysicsCrash != null)
230 handlerPhysicsCrash(RegionInfo);
231 }
232
233 public virtual bool PresenceChildStatus(UUID avatarID) 221 public virtual bool PresenceChildStatus(UUID avatarID)
234 { 222 {
235 return false; 223 return false;
@@ -562,6 +550,14 @@ namespace OpenSim.Region.Framework.Scenes
562 get { return false; } 550 get { return false; }
563 } 551 }
564 552
553 public void Restart()
554 {
555 // This has to be here to fire the event
556 restart handlerPhysicsCrash = OnRestart;
557 if (handlerPhysicsCrash != null)
558 handlerPhysicsCrash(RegionInfo);
559 }
560
565 public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep); 561 public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep);
566 } 562 }
567} 563}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 26ef0dd..eba6e75 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -404,10 +404,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
404 // 404 //
405 CheckThreatLevel(ThreatLevel.High, "osRegionRestart"); 405 CheckThreatLevel(ThreatLevel.High, "osRegionRestart");
406 406
407 IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>();
407 m_host.AddScriptLPS(1); 408 m_host.AddScriptLPS(1);
408 if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false)) 409 if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null))
409 { 410 {
410 World.Restart((float)seconds); 411 if (seconds < 15)
412 {
413 restartModule.AbortRestart("Restart aborted");
414 return 1;
415 }
416
417 List<int> times = new List<int>();
418 while (seconds > 0)
419 {
420 times.Add((int)seconds);
421 if (seconds > 300)
422 seconds -= 120;
423 else if (seconds > 30)
424 seconds -= 30;
425 else
426 seconds -= 15;
427 }
428
429 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
411 return 1; 430 return 1;
412 } 431 }
413 else 432 else
@@ -2328,4 +2347,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2328 return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); 2347 return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
2329 } 2348 }
2330 } 2349 }
2331} \ No newline at end of file 2350}