diff options
author | Justin Clark-Casey (justincc) | 2013-08-25 20:17:04 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-09-04 00:45:32 +0100 |
commit | 3f8a99937e597cf63e346dd03c5c116fb8ee7bbc (patch) | |
tree | ac8ffa70f96eb9d17197beb8a693eb1df5524d5a /OpenSim/Region/CoreModules | |
parent | Whitespace fubar. (diff) | |
download | opensim-SC_OLD-3f8a99937e597cf63e346dd03c5c116fb8ee7bbc.zip opensim-SC_OLD-3f8a99937e597cf63e346dd03c5c116fb8ee7bbc.tar.gz opensim-SC_OLD-3f8a99937e597cf63e346dd03c5c116fb8ee7bbc.tar.bz2 opensim-SC_OLD-3f8a99937e597cf63e346dd03c5c116fb8ee7bbc.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.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-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) |