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 | |
parent | WARNING: LOTS OF CONFIGURATION CHANGES AFFECTING PRIMARILY HG CONFIGS. Added ... (diff) | |
parent | Export the module interface for restart (diff) | |
download | opensim-SC_OLD-1cbd2842d56dc4ee4dc26ecfbea45768a4aa8887.zip opensim-SC_OLD-1cbd2842d56dc4ee4dc26ecfbea45768a4aa8887.tar.gz opensim-SC_OLD-1cbd2842d56dc4ee4dc26ecfbea45768a4aa8887.tar.bz2 opensim-SC_OLD-1cbd2842d56dc4ee4dc26ecfbea45768a4aa8887.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to '')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 17 | ||||
-rw-r--r-- | OpenSim/Framework/IScene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Region/RestartModule.cs | 263 | ||||
-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 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 25 |
9 files changed, 373 insertions, 79 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/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs new file mode 100644 index 0000000..c65aa6a --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -0,0 +1,263 @@ | |||
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 System.Reflection; | ||
30 | using System.Timers; | ||
31 | using System.Threading; | ||
32 | using System.Collections.Generic; | ||
33 | using log4net; | ||
34 | using Nini.Config; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Console; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | using Timer=System.Timers.Timer; | ||
41 | using Mono.Addins; | ||
42 | |||
43 | namespace OpenSim.Region.CoreModules.World.Region | ||
44 | { | ||
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RestartModule")] | ||
46 | public class RestartModule : INonSharedRegionModule, IRestartModule | ||
47 | { | ||
48 | private static readonly ILog m_log = | ||
49 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | protected Scene m_Scene; | ||
52 | protected Timer m_CountdownTimer = null; | ||
53 | protected DateTime m_RestartBegin; | ||
54 | protected List<int> m_Alerts; | ||
55 | protected string m_Message; | ||
56 | protected UUID m_Initiator; | ||
57 | protected bool m_Notice = false; | ||
58 | protected IDialogModule m_DialogModule = null; | ||
59 | |||
60 | public void Initialise(IConfigSource config) | ||
61 | { | ||
62 | } | ||
63 | |||
64 | public void AddRegion(Scene scene) | ||
65 | { | ||
66 | m_Scene = scene; | ||
67 | scene.RegisterModuleInterface<IRestartModule>(this); | ||
68 | MainConsole.Instance.Commands.AddCommand("RestartModule", | ||
69 | false, "region restart bluebox", | ||
70 | "region restart bluebox <message> <time> ...", | ||
71 | "Restart the region", HandleRegionRestart); | ||
72 | MainConsole.Instance.Commands.AddCommand("RestartModule", | ||
73 | false, "region restart notice", | ||
74 | "region restart notice <message> <time> ...", | ||
75 | "Restart the region", HandleRegionRestart); | ||
76 | MainConsole.Instance.Commands.AddCommand("RestartModule", | ||
77 | false, "region restart abort", | ||
78 | "region restart abort [<message>]", | ||
79 | "Restart the region", HandleRegionRestart); | ||
80 | } | ||
81 | |||
82 | public void RegionLoaded(Scene scene) | ||
83 | { | ||
84 | m_DialogModule = m_Scene.RequestModuleInterface<IDialogModule>(); | ||
85 | } | ||
86 | |||
87 | public void RemoveRegion(Scene scene) | ||
88 | { | ||
89 | } | ||
90 | |||
91 | public void Close() | ||
92 | { | ||
93 | } | ||
94 | |||
95 | public string Name | ||
96 | { | ||
97 | get { return "RestartModule"; } | ||
98 | } | ||
99 | |||
100 | public Type ReplaceableInterface | ||
101 | { | ||
102 | get { return typeof(IRestartModule); } | ||
103 | } | ||
104 | |||
105 | public TimeSpan TimeUntilRestart | ||
106 | { | ||
107 | get { return DateTime.Now - m_RestartBegin; } | ||
108 | } | ||
109 | |||
110 | public void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice) | ||
111 | { | ||
112 | if (m_CountdownTimer != null) | ||
113 | return; | ||
114 | |||
115 | if (alerts == null) | ||
116 | { | ||
117 | m_Scene.RestartNow(); | ||
118 | return; | ||
119 | } | ||
120 | |||
121 | m_Message = message; | ||
122 | m_Initiator = initiator; | ||
123 | m_Notice = notice; | ||
124 | m_Alerts = new List<int>(alerts); | ||
125 | m_Alerts.Sort(); | ||
126 | m_Alerts.Reverse(); | ||
127 | |||
128 | if (m_Alerts[0] == 0) | ||
129 | { | ||
130 | m_Scene.RestartNow(); | ||
131 | return; | ||
132 | } | ||
133 | |||
134 | int nextInterval = DoOneNotice(); | ||
135 | |||
136 | SetTimer(nextInterval); | ||
137 | } | ||
138 | |||
139 | public int DoOneNotice() | ||
140 | { | ||
141 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) | ||
142 | { | ||
143 | m_Scene.RestartNow(); | ||
144 | return 0; | ||
145 | } | ||
146 | |||
147 | int nextAlert = 0; | ||
148 | while (m_Alerts.Count > 1) | ||
149 | { | ||
150 | if (m_Alerts[1] == m_Alerts[0]) | ||
151 | { | ||
152 | m_Alerts.RemoveAt(0); | ||
153 | continue; | ||
154 | } | ||
155 | nextAlert = m_Alerts[1]; | ||
156 | break; | ||
157 | } | ||
158 | |||
159 | int currentAlert = m_Alerts[0]; | ||
160 | |||
161 | m_Alerts.RemoveAt(0); | ||
162 | |||
163 | int minutes = currentAlert / 60; | ||
164 | string currentAlertString = String.Empty; | ||
165 | if (minutes > 0) | ||
166 | { | ||
167 | if (minutes == 1) | ||
168 | currentAlertString += "1 minute"; | ||
169 | else | ||
170 | currentAlertString += String.Format("{0} minutes", minutes); | ||
171 | if ((currentAlert % 60) != 0) | ||
172 | currentAlertString += " and "; | ||
173 | } | ||
174 | if ((currentAlert % 60) != 0) | ||
175 | { | ||
176 | int seconds = currentAlert % 60; | ||
177 | if (seconds == 1) | ||
178 | currentAlertString += "1 second"; | ||
179 | else | ||
180 | currentAlertString += String.Format("{0} seconds", seconds); | ||
181 | } | ||
182 | |||
183 | string msg = String.Format(m_Message, currentAlertString); | ||
184 | |||
185 | if (m_DialogModule != null && msg != String.Empty) | ||
186 | { | ||
187 | if (m_Notice) | ||
188 | m_DialogModule.SendGeneralAlert(msg); | ||
189 | else | ||
190 | m_DialogModule.SendNotificationToUsersInRegion(m_Initiator, "System", msg); | ||
191 | } | ||
192 | |||
193 | return currentAlert - nextAlert; | ||
194 | } | ||
195 | |||
196 | public void SetTimer(int intervalSeconds) | ||
197 | { | ||
198 | m_CountdownTimer = new Timer(); | ||
199 | m_CountdownTimer.AutoReset = false; | ||
200 | m_CountdownTimer.Interval = intervalSeconds * 1000; | ||
201 | m_CountdownTimer.Elapsed += OnTimer; | ||
202 | m_CountdownTimer.Start(); | ||
203 | } | ||
204 | |||
205 | private void OnTimer(object source, ElapsedEventArgs e) | ||
206 | { | ||
207 | int nextInterval = DoOneNotice(); | ||
208 | |||
209 | SetTimer(nextInterval); | ||
210 | } | ||
211 | |||
212 | public void AbortRestart(string message) | ||
213 | { | ||
214 | if (m_CountdownTimer != null) | ||
215 | { | ||
216 | m_CountdownTimer.Stop(); | ||
217 | m_CountdownTimer = null; | ||
218 | if (m_DialogModule != null && message != String.Empty) | ||
219 | m_DialogModule.SendGeneralAlert(message); | ||
220 | } | ||
221 | } | ||
222 | |||
223 | private void HandleRegionRestart(string module, string[] args) | ||
224 | { | ||
225 | if (!(MainConsole.Instance.ConsoleScene is Scene)) | ||
226 | return; | ||
227 | |||
228 | if (MainConsole.Instance.ConsoleScene != m_Scene) | ||
229 | return; | ||
230 | |||
231 | if (args.Length < 5) | ||
232 | { | ||
233 | if (args.Length > 2) | ||
234 | { | ||
235 | if (args[2] == "abort") | ||
236 | { | ||
237 | string msg = String.Empty; | ||
238 | if (args.Length > 3) | ||
239 | msg = args[3]; | ||
240 | |||
241 | AbortRestart(msg); | ||
242 | |||
243 | MainConsole.Instance.Output("Region restart aborted"); | ||
244 | return; | ||
245 | } | ||
246 | } | ||
247 | |||
248 | MainConsole.Instance.Output("Error: restart region <mode> <name> <time> ..."); | ||
249 | return; | ||
250 | } | ||
251 | |||
252 | bool notice = false; | ||
253 | if (args[2] == "notice") | ||
254 | notice = true; | ||
255 | |||
256 | List<int> times = new List<int>(); | ||
257 | for (int i = 4 ; i < args.Length ; i++) | ||
258 | times.Add(Convert.ToInt32(args[i])); | ||
259 | |||
260 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); | ||
261 | } | ||
262 | } | ||
263 | } | ||
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 | } |
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index d770ad1..3386e72 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -276,7 +276,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
276 | 276 | ||
277 | m_log.Debug("[MESH]: experimental mesh proxy generation"); | 277 | m_log.Debug("[MESH]: experimental mesh proxy generation"); |
278 | 278 | ||
279 | OSD meshOsd; | 279 | OSD meshOsd = null; |
280 | 280 | ||
281 | if (primShape.SculptData.Length <= 0) | 281 | if (primShape.SculptData.Length <= 0) |
282 | { | 282 | { |
@@ -287,7 +287,14 @@ namespace OpenSim.Region.Physics.Meshing | |||
287 | long start = 0; | 287 | long start = 0; |
288 | using (MemoryStream data = new MemoryStream(primShape.SculptData)) | 288 | using (MemoryStream data = new MemoryStream(primShape.SculptData)) |
289 | { | 289 | { |
290 | meshOsd = (OSDMap)OSDParser.DeserializeLLSDBinary(data); | 290 | try |
291 | { | ||
292 | meshOsd = (OSDMap)OSDParser.DeserializeLLSDBinary(data); | ||
293 | } | ||
294 | catch (Exception e) | ||
295 | { | ||
296 | m_log.Error("[MESH]: Exception deserializing mesh asset header:" + e.ToString()); | ||
297 | } | ||
291 | start = data.Position; | 298 | start = data.Position; |
292 | } | 299 | } |
293 | 300 | ||
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 | } |