aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Region/RestartModule.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
index 8bac9e6..bf6592f 100644
--- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
+++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
@@ -61,6 +61,8 @@ namespace OpenSim.Region.CoreModules.World.Region
61 protected IDialogModule m_DialogModule = null; 61 protected IDialogModule m_DialogModule = null;
62 protected string m_MarkerPath = String.Empty; 62 protected string m_MarkerPath = String.Empty;
63 private int[] m_CurrentAlerts = null; 63 private int[] m_CurrentAlerts = null;
64 protected bool m_shortCircuitDelays = false;
65 protected bool m_rebootAll = false;
64 66
65 public void Initialise(IConfigSource config) 67 public void Initialise(IConfigSource config)
66 { 68 {
@@ -69,6 +71,9 @@ namespace OpenSim.Region.CoreModules.World.Region
69 { 71 {
70 m_MarkerPath = restartConfig.GetString("MarkerPath", String.Empty); 72 m_MarkerPath = restartConfig.GetString("MarkerPath", String.Empty);
71 } 73 }
74 IConfig startupConfig = config.Configs["Startup"];
75 m_shortCircuitDelays = startupConfig.GetBoolean("SkipDelayOnEmptyRegion", false);
76 m_rebootAll = startupConfig.GetBoolean("InworldRestartShutsDown", false);
72 } 77 }
73 78
74 public void AddRegion(Scene scene) 79 public void AddRegion(Scene scene)
@@ -250,6 +255,14 @@ namespace OpenSim.Region.CoreModules.World.Region
250 private void OnTimer(object source, ElapsedEventArgs e) 255 private void OnTimer(object source, ElapsedEventArgs e)
251 { 256 {
252 int nextInterval = DoOneNotice(true); 257 int nextInterval = DoOneNotice(true);
258 if (m_shortCircuitDelays)
259 {
260 if (CountAgents() == 0)
261 {
262 m_Scene.RestartNow();
263 return;
264 }
265 }
253 266
254 SetTimer(nextInterval); 267 SetTimer(nextInterval);
255 } 268 }
@@ -349,5 +362,35 @@ namespace OpenSim.Region.CoreModules.World.Region
349 { 362 {
350 } 363 }
351 } 364 }
365
366 int CountAgents()
367 {
368 m_log.Info("[RESTART MODULE]: Counting affected avatars");
369 int agents = 0;
370
371 if (m_rebootAll)
372 {
373 foreach (Scene s in SceneManager.Instance.Scenes)
374 {
375 foreach (ScenePresence sp in s.GetScenePresences())
376 {
377 if (!sp.IsChildAgent)
378 agents++;
379 }
380 }
381 }
382 else
383 {
384 foreach (ScenePresence sp in m_Scene.GetScenePresences())
385 {
386 if (!sp.IsChildAgent)
387 agents++;
388 }
389 }
390
391 m_log.InfoFormat("[RESTART MODULE]: Avatars in region: {0}", agents);
392
393 return agents;
394 }
352 } 395 }
353} 396}