diff options
author | Justin Clark-Casey (justincc) | 2013-08-25 20:17:04 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-08-25 20:17:04 +0100 |
commit | 60e4ce20b86e0594f4ed457b6a7329560dbaa121 (patch) | |
tree | 7fcf21047ca298d27538371f38a97ad0d50d5b5f | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-60e4ce20b86e0594f4ed457b6a7329560dbaa121.zip opensim-SC_OLD-60e4ce20b86e0594f4ed457b6a7329560dbaa121.tar.gz opensim-SC_OLD-60e4ce20b86e0594f4ed457b6a7329560dbaa121.tar.bz2 opensim-SC_OLD-60e4ce20b86e0594f4ed457b6a7329560dbaa121.tar.xz |
Fix exception thrown after a region has been restarted through scheduling.
This exception was very likely harmless since it occurred after the restart had taken place, but still misleading.
Thanks to SCGreyWolf for the code change suggestion in http://opensimulator.org/mantis/view.php?id=6747, though I did this in a slightly different way.
-rw-r--r-- | OpenSim/Region/CoreModules/World/Region/RestartModule.cs | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index 249a40d..75a8295 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -46,8 +46,8 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RestartModule")] | 46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RestartModule")] |
47 | public class RestartModule : INonSharedRegionModule, IRestartModule | 47 | public class RestartModule : INonSharedRegionModule, IRestartModule |
48 | { | 48 | { |
49 | // private static readonly ILog m_log = | 49 | private static readonly ILog m_log = |
50 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | protected Scene m_Scene; | 52 | protected Scene m_Scene; |
53 | protected Timer m_CountdownTimer = null; | 53 | protected Timer m_CountdownTimer = null; |
@@ -203,18 +203,30 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
203 | 203 | ||
204 | public void SetTimer(int intervalSeconds) | 204 | public void SetTimer(int intervalSeconds) |
205 | { | 205 | { |
206 | m_CountdownTimer = new Timer(); | 206 | if (intervalSeconds > 0) |
207 | m_CountdownTimer.AutoReset = false; | 207 | { |
208 | m_CountdownTimer.Interval = intervalSeconds * 1000; | 208 | m_CountdownTimer = new Timer(); |
209 | m_CountdownTimer.Elapsed += OnTimer; | 209 | m_CountdownTimer.AutoReset = false; |
210 | m_CountdownTimer.Start(); | 210 | m_CountdownTimer.Interval = intervalSeconds * 1000; |
211 | m_CountdownTimer.Elapsed += OnTimer; | ||
212 | m_CountdownTimer.Start(); | ||
213 | } | ||
214 | else if (m_CountdownTimer != null) | ||
215 | { | ||
216 | m_CountdownTimer.Stop(); | ||
217 | m_CountdownTimer = null; | ||
218 | } | ||
219 | else | ||
220 | { | ||
221 | m_log.WarnFormat( | ||
222 | "[RESTART MODULE]: Tried to set restart timer to {0} in {1}, which is not a valid interval", | ||
223 | intervalSeconds, m_Scene.Name); | ||
224 | } | ||
211 | } | 225 | } |
212 | 226 | ||
213 | private void OnTimer(object source, ElapsedEventArgs e) | 227 | private void OnTimer(object source, ElapsedEventArgs e) |
214 | { | 228 | { |
215 | int nextInterval = DoOneNotice(); | 229 | SetTimer(DoOneNotice()); |
216 | |||
217 | SetTimer(nextInterval); | ||
218 | } | 230 | } |
219 | 231 | ||
220 | public void AbortRestart(string message) | 232 | public void AbortRestart(string message) |