From b5a3c74a5cbd1634d021923124a997fc4945e5ef Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 12 Oct 2012 02:52:08 +0100
Subject: Add "active true|false" to "debug scene" console command.
This allows the scene update and maintenance loops to be started and stopped for debug purposes.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 40 +++++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index fb2decc..7f4f7e5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -306,6 +306,30 @@ namespace OpenSim.Region.Framework.Scenes
}
private volatile bool m_shuttingDown;
+ ///
+ /// Is the scene active?
+ ///
+ ///
+ /// If false, maintenance and update loops are not run.
+ ///
+ public bool Active
+ {
+ get { return m_active; }
+ set
+ {
+ if (value)
+ {
+ if (!m_active)
+ Start();
+ }
+ else
+ {
+ m_active = false;
+ }
+ }
+ }
+ private volatile bool m_active;
+
// private int m_lastUpdate;
// private bool m_firstHeartbeat = true;
@@ -1159,6 +1183,14 @@ namespace OpenSim.Region.Framework.Scenes
public void SetSceneCoreDebug(Dictionary options)
{
+ if (options.ContainsKey("active"))
+ {
+ bool active;
+
+ if (bool.TryParse(options["active"], out active))
+ Active = active;
+ }
+
if (options.ContainsKey("scripting"))
{
bool enableScripts = true;
@@ -1298,6 +1330,8 @@ namespace OpenSim.Region.Framework.Scenes
///
public void Start()
{
+ m_active = true;
+
// m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName);
//m_heartbeatTimer.Enabled = true;
@@ -1339,7 +1373,7 @@ namespace OpenSim.Region.Framework.Scenes
#region Update Methods
///
- /// Performs per-frame updates regularly
+ /// Activate the various loops necessary to continually update the scene.
///
private void Heartbeat()
{
@@ -1396,7 +1430,7 @@ namespace OpenSim.Region.Framework.Scenes
List coarseLocations;
List avatarUUIDs;
- while (!m_shuttingDown && (endRun == null || MaintenanceRun < endRun))
+ while (Active && !m_shuttingDown && (endRun == null || MaintenanceRun < endRun))
{
runtc = Util.EnvironmentTickCount();
++MaintenanceRun;
@@ -1455,7 +1489,7 @@ namespace OpenSim.Region.Framework.Scenes
int previousFrameTick, tmpMS;
int maintc = Util.EnvironmentTickCount();
- while (!m_shuttingDown && (endFrame == null || Frame < endFrame))
+ while (Active && !m_shuttingDown && (endFrame == null || Frame < endFrame))
{
++Frame;
--
cgit v1.1