diff options
author | Diva Canto | 2010-11-25 16:27:19 -0800 |
---|---|---|
committer | Diva Canto | 2010-11-25 16:27:19 -0800 |
commit | 1cbd2842d56dc4ee4dc26ecfbea45768a4aa8887 (patch) | |
tree | a077780dbb79749adca9f4b7c5da121b0ab42db2 /OpenSim/Region/Framework | |
parent | WARNING: LOTS OF CONFIGURATION CHANGES AFFECTING PRIMARILY HG CONFIGS. Added ... (diff) | |
parent | Export the module interface for restart (diff) | |
download | opensim-SC-1cbd2842d56dc4ee4dc26ecfbea45768a4aa8887.zip opensim-SC-1cbd2842d56dc4ee4dc26ecfbea45768a4aa8887.tar.gz opensim-SC-1cbd2842d56dc4ee4dc26ecfbea45768a4aa8887.tar.bz2 opensim-SC-1cbd2842d56dc4ee4dc26ecfbea45768a4aa8887.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IRestartModule.cs | 39 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 57 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneBase.cs | 20 |
3 files changed, 49 insertions, 67 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IRestartModule.cs b/OpenSim/Region/Framework/Interfaces/IRestartModule.cs new file mode 100644 index 0000000..c68550f --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IRestartModule.cs | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | |||
31 | namespace OpenSim.Region.Framework.Interfaces | ||
32 | { | ||
33 | public interface IRestartModule | ||
34 | { | ||
35 | TimeSpan TimeUntilRestart { get; } | ||
36 | void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice); | ||
37 | void AbortRestart(string message); | ||
38 | } | ||
39 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4d90e1b..70aceb1 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 | } |