diff options
author | Melanie | 2011-05-24 00:53:28 +0200 |
---|---|---|
committer | Melanie | 2011-05-24 01:19:48 +0100 |
commit | 178d541dcaa2d8258e3820b39818d8fd69def72e (patch) | |
tree | ae6a26a85213f6e4f6b5a830f3c5ab5588745774 | |
parent | Fix Mantis #4429: Allow llGiveInventory to work across sim borders. (diff) | |
download | opensim-SC-178d541dcaa2d8258e3820b39818d8fd69def72e.zip opensim-SC-178d541dcaa2d8258e3820b39818d8fd69def72e.tar.gz opensim-SC-178d541dcaa2d8258e3820b39818d8fd69def72e.tar.bz2 opensim-SC-178d541dcaa2d8258e3820b39818d8fd69def72e.tar.xz |
Add an event for an orderly region shutdown that fires once per region before
the SceneGraph is torn down.
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 25 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 2 |
2 files changed, 27 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index fd62535..e04317b 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -111,6 +111,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
111 | 111 | ||
112 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | 112 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; |
113 | 113 | ||
114 | public delegate void SceneShuttingDownDelegate(Scene scene); | ||
115 | |||
116 | public event SceneShuttingDownDelegate OnSceneShuttingDown; | ||
117 | |||
114 | /// <summary> | 118 | /// <summary> |
115 | /// Fired when an object is touched/grabbed. | 119 | /// Fired when an object is touched/grabbed. |
116 | /// </summary> | 120 | /// </summary> |
@@ -2193,5 +2197,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
2193 | } | 2197 | } |
2194 | } | 2198 | } |
2195 | } | 2199 | } |
2200 | |||
2201 | public void TriggerSceneShuttingDown(Scene s) | ||
2202 | { | ||
2203 | SceneShuttingDownDelegate handler = OnSceneShuttingDown; | ||
2204 | if (handler != null) | ||
2205 | { | ||
2206 | foreach (SceneShuttingDownDelegate d in handler.GetInvocationList()) | ||
2207 | { | ||
2208 | try | ||
2209 | { | ||
2210 | d(s); | ||
2211 | } | ||
2212 | catch (Exception e) | ||
2213 | { | ||
2214 | m_log.ErrorFormat( | ||
2215 | "[EVENT MANAGER]: Delegate for TriggerSceneShuttingDown failed - continuing. {0} {1}", | ||
2216 | e.Message, e.StackTrace); | ||
2217 | } | ||
2218 | } | ||
2219 | } | ||
2220 | } | ||
2196 | } | 2221 | } |
2197 | } | 2222 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b9690fe..eabc9a6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1064,6 +1064,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1064 | shuttingdown = true; | 1064 | shuttingdown = true; |
1065 | 1065 | ||
1066 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1066 | m_log.Debug("[SCENE]: Persisting changed objects"); |
1067 | EventManager.TriggerSceneShuttingDown(this); | ||
1068 | |||
1067 | EntityBase[] entities = GetEntities(); | 1069 | EntityBase[] entities = GetEntities(); |
1068 | foreach (EntityBase entity in entities) | 1070 | foreach (EntityBase entity in entities) |
1069 | { | 1071 | { |