From 0ce9ad4a56ecfcb021208acb4e9650612bc7e931 Mon Sep 17 00:00:00 2001
From: Dan Lake
Date: Wed, 1 Feb 2012 16:27:20 -0800
Subject: Add event RegionHeartbeatEnd for modules interested in coordinating
activity with region heartbeats
---
OpenSim/Region/Framework/Scenes/EventManager.cs | 24 ++++++++++++++++++++++++
OpenSim/Region/Framework/Scenes/Scene.cs | 22 ++++++++++++----------
2 files changed, 36 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 3d96f40..d31d380 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -407,6 +407,9 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void RegionStarted(Scene scene);
public event RegionStarted OnRegionStarted;
+ public delegate void RegionHeartbeatEnd(Scene scene);
+ public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
+
public delegate void LoginsEnabled(string regionName);
public event LoginsEnabled OnLoginsEnabled;
@@ -2291,6 +2294,27 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ public void TriggerRegionHeartbeatEnd(Scene scene)
+ {
+ RegionHeartbeatEnd handler = OnRegionHeartbeatEnd;
+
+ if (handler != null)
+ {
+ foreach (RegionHeartbeatEnd d in handler.GetInvocationList())
+ {
+ try
+ {
+ d(scene);
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatEnd failed - continuing {0} - {1}",
+ e.Message, e.StackTrace);
+ }
+ }
+ }
+ }
+
public void TriggerLoginsEnabled (string regionName)
{
LoginsEnabled handler = OnLoginsEnabled;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index bfe8d2c..bbd2163 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1385,6 +1385,8 @@ namespace OpenSim.Region.Framework.Scenes
RegionInfo.RegionName, e.Message, e.StackTrace);
}
+ EventManager.TriggerRegionHeartbeatEnd(this);
+
maintc = Util.EnvironmentTickCountSubtract(maintc);
maintc = (int)(MinFrameTime * 1000) - maintc;
@@ -4290,16 +4292,16 @@ namespace OpenSim.Region.Framework.Scenes
public SceneObjectGroup GetGroupByPrim(uint localID)
{
return m_sceneGraph.GetGroupByPrim(localID);
- }
-
- ///
- /// Get a scene object group that contains the prim with the given uuid
- ///
- ///
- /// null if no scene object group containing that prim is found
- public SceneObjectGroup GetGroupByPrim(UUID fullID)
- {
- return m_sceneGraph.GetGroupByPrim(fullID);
+ }
+
+ ///
+ /// Get a scene object group that contains the prim with the given uuid
+ ///
+ ///
+ /// null if no scene object group containing that prim is found
+ public SceneObjectGroup GetGroupByPrim(UUID fullID)
+ {
+ return m_sceneGraph.GetGroupByPrim(fullID);
}
public override bool TryGetScenePresence(UUID agentID, out ScenePresence sp)
--
cgit v1.1