diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 69 |
1 files changed, 2 insertions, 67 deletions
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 |