aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Region/RestartModule.cs32
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)