aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-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
4 files changed, 49 insertions, 83 deletions
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}