diff options
author | Melanie | 2010-11-25 03:16:52 +0000 |
---|---|---|
committer | Melanie | 2010-11-25 03:16:52 +0000 |
commit | 57c4def254b85997f5b8a4cd4e7d1db550947290 (patch) | |
tree | 89c9521d8e208820ff54a1505088792b1eabb1a6 /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | Finish the RestartModule and fix some bugs. Add new console commands: (diff) | |
download | opensim-SC-57c4def254b85997f5b8a4cd4e7d1db550947290.zip opensim-SC-57c4def254b85997f5b8a4cd4e7d1db550947290.tar.gz opensim-SC-57c4def254b85997f5b8a4cd4e7d1db550947290.tar.bz2 opensim-SC-57c4def254b85997f5b8a4cd4e7d1db550947290.tar.xz |
Change all restarting to use the restart module. Remove hardcoded behavior
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 57 |
1 files changed, 2 insertions, 55 deletions
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 |