diff options
author | Melanie Thielker | 2017-03-23 23:00:14 +0000 |
---|---|---|
committer | Melanie Thielker | 2017-03-31 14:38:41 +0100 |
commit | 3e880cee45ea0d85297c51d3ed87490d47a5bd94 (patch) | |
tree | 3963a804871894b8356cba781990417fb30eba9e /OpenSim/Region | |
parent | Make the file based log file format sane for the casual user (diff) | |
download | opensim-SC_OLD-3e880cee45ea0d85297c51d3ed87490d47a5bd94.zip opensim-SC_OLD-3e880cee45ea0d85297c51d3ed87490d47a5bd94.tar.gz opensim-SC_OLD-3e880cee45ea0d85297c51d3ed87490d47a5bd94.tar.bz2 opensim-SC_OLD-3e880cee45ea0d85297c51d3ed87490d47a5bd94.tar.xz |
Allow short-circuiting region restart delays of there are no users left
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Region/RestartModule.cs | 43 |
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 | } |