aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2010-11-25 03:16:52 +0000
committerMelanie2010-11-25 03:16:52 +0000
commit57c4def254b85997f5b8a4cd4e7d1db550947290 (patch)
tree89c9521d8e208820ff54a1505088792b1eabb1a6
parentFinish the RestartModule and fix some bugs. Add new console commands: (diff)
downloadopensim-SC_OLD-57c4def254b85997f5b8a4cd4e7d1db550947290.zip
opensim-SC_OLD-57c4def254b85997f5b8a4cd4e7d1db550947290.tar.gz
opensim-SC_OLD-57c4def254b85997f5b8a4cd4e7d1db550947290.tar.bz2
opensim-SC_OLD-57c4def254b85997f5b8a4cd4e7d1db550947290.tar.xz
Change all restarting to use the restart module. Remove hardcoded behavior
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs17
-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.cs57
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs25
6 files changed, 62 insertions, 77 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index c09252a..1b4d1ea 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -208,18 +208,25 @@ namespace OpenSim.ApplicationPlugins.RemoteController
208 208
209 UUID regionID = new UUID((string) requestData["regionID"]); 209 UUID regionID = new UUID((string) requestData["regionID"]);
210 210
211 responseData["accepted"] = true;
212 responseData["success"] = true;
213 response.Value = responseData;
214
215 Scene rebootedScene; 211 Scene rebootedScene;
216 212
213 responseData["success"] = false;
214 responseData["accepted"] = true;
217 if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene)) 215 if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene))
218 throw new Exception("region not found"); 216 throw new Exception("region not found");
219 217
220 responseData["rebooting"] = true; 218 responseData["rebooting"] = true;
219
220 IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>();
221 if (restartModule != null)
222 {
223 List<int> times = new List<int> { 30, 15 };
224
225 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
226 responseData["success"] = true;
227 }
221 response.Value = responseData; 228 response.Value = responseData;
222 rebootedScene.Restart(30); 229
223 } 230 }
224 catch (Exception e) 231 catch (Exception e)
225 { 232 {
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 622fc08..ddae20f 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -231,7 +231,23 @@ namespace OpenSim.Region.CoreModules.World.Estate
231 231
232 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) 232 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
233 { 233 {
234 m_scene.Restart(timeInSeconds); 234 IRestartModule restartModule = m_scene.RequestModuleInterface<IRestartModule>();
235 if (restartModule != null)
236 {
237 List<int> times = new List<int>();
238 while (timeInSeconds > 0)
239 {
240 times.Add(timeInSeconds);
241 if (timeInSeconds > 300)
242 timeInSeconds -= 120;
243 else if (timeInSeconds > 30)
244 timeInSeconds -= 30;
245 else
246 timeInSeconds -= 15;
247 }
248
249 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
250 }
235 } 251 }
236 252
237 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID) 253 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4fc2cbc..129b52d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -893,60 +893,6 @@ namespace OpenSim.Region.Framework.Scenes
893 return new GridRegion(RegionInfo); 893 return new GridRegion(RegionInfo);
894 } 894 }
895 895
896 /// <summary>
897 /// Given float seconds, this will restart the region.
898 /// </summary>
899 /// <param name="seconds">float indicating duration before restart.</param>
900 public virtual void Restart(float seconds)
901 {
902 // notifications are done in 15 second increments
903 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request
904 // It's a 'Cancel restart' request.
905
906 // RestartNow() does immediate restarting.
907 if (seconds < 15)
908 {
909 m_restartTimer.Stop();
910 m_dialogModule.SendGeneralAlert("Restart Aborted");
911 }
912 else
913 {
914 // Now we figure out what to set the timer to that does the notifications and calls, RestartNow()
915 m_restartTimer.Interval = 15000;
916 m_incrementsof15seconds = (int)seconds / 15;
917 m_RestartTimerCounter = 0;
918 m_restartTimer.AutoReset = true;
919 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
920 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
921 m_restartTimer.Start();
922 m_dialogModule.SendNotificationToUsersInRegion(
923 UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0)));
924 }
925 }
926
927 // The Restart timer has occured.
928 // We have to figure out if this is a notification or if the number of seconds specified in Restart
929 // have elapsed.
930 // If they have elapsed, call RestartNow()
931 public void RestartTimer_Elapsed(object sender, ElapsedEventArgs e)
932 {
933 m_RestartTimerCounter++;
934 if (m_RestartTimerCounter <= m_incrementsof15seconds)
935 {
936 if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7)
937 m_dialogModule.SendNotificationToUsersInRegion(
938 UUID.Random(),
939 String.Empty,
940 RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter) * 15) + " seconds");
941 }
942 else
943 {
944 m_restartTimer.Stop();
945 m_restartTimer.AutoReset = false;
946 RestartNow();
947 }
948 }
949
950 // This causes the region to restart immediatley. 896 // This causes the region to restart immediatley.
951 public void RestartNow() 897 public void RestartNow()
952 { 898 {
@@ -969,7 +915,8 @@ namespace OpenSim.Region.Framework.Scenes
969 Close(); 915 Close();
970 916
971 m_log.Error("[REGION]: Firing Region Restart Message"); 917 m_log.Error("[REGION]: Firing Region Restart Message");
972 base.Restart(0); 918
919 base.Restart();
973 } 920 }
974 921
975 // This is a helper function that notifies root agents in this region that a new sim near them has come up 922 // 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 fc92f23..827626f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -395,10 +395,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
395 // 395 //
396 CheckThreatLevel(ThreatLevel.High, "osRegionRestart"); 396 CheckThreatLevel(ThreatLevel.High, "osRegionRestart");
397 397
398 IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>();
398 m_host.AddScriptLPS(1); 399 m_host.AddScriptLPS(1);
399 if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false)) 400 if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null))
400 { 401 {
401 World.Restart((float)seconds); 402 if (seconds < 15)
403 {
404 restartModule.AbortRestart("Restart aborted");
405 return 1;
406 }
407
408 List<int> times = new List<int>();
409 while (seconds > 0)
410 {
411 times.Add((int)seconds);
412 if (seconds > 300)
413 seconds -= 120;
414 else if (seconds > 30)
415 seconds -= 30;
416 else
417 seconds -= 15;
418 }
419
420 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
402 return 1; 421 return 1;
403 } 422 }
404 else 423 else
@@ -2315,4 +2334,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2315 return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); 2334 return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
2316 } 2335 }
2317 } 2336 }
2318} \ No newline at end of file 2337}