diff options
author | Melanie | 2011-05-24 00:53:28 +0200 |
---|---|---|
committer | Melanie | 2011-05-24 00:53:28 +0200 |
commit | 8b42f824d3ccd487e1d0917b155faa75fd311927 (patch) | |
tree | 9b491340f001f8c1ba56588dcd785d20bba1a092 /OpenSim | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
download | opensim-SC_OLD-8b42f824d3ccd487e1d0917b155faa75fd311927.zip opensim-SC_OLD-8b42f824d3ccd487e1d0917b155faa75fd311927.tar.gz opensim-SC_OLD-8b42f824d3ccd487e1d0917b155faa75fd311927.tar.bz2 opensim-SC_OLD-8b42f824d3ccd487e1d0917b155faa75fd311927.tar.xz |
Add an event for an orderly region shutdown that fires once per region before
the SceneGraph is torn down.
Diffstat (limited to 'OpenSim')
-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 4ce7a6c..d326141 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -115,6 +115,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
115 | 115 | ||
116 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | 116 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; |
117 | 117 | ||
118 | public delegate void SceneShuttingDownDelegate(Scene scene); | ||
119 | |||
120 | public event SceneShuttingDownDelegate OnSceneShuttingDown; | ||
121 | |||
118 | /// <summary> | 122 | /// <summary> |
119 | /// Fired when an object is touched/grabbed. | 123 | /// Fired when an object is touched/grabbed. |
120 | /// </summary> | 124 | /// </summary> |
@@ -2217,5 +2221,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
2217 | } | 2221 | } |
2218 | } | 2222 | } |
2219 | } | 2223 | } |
2224 | |||
2225 | public void TriggerSceneShuttingDown(Scene s) | ||
2226 | { | ||
2227 | SceneShuttingDownDelegate handler = OnSceneShuttingDown; | ||
2228 | if (handler != null) | ||
2229 | { | ||
2230 | foreach (SceneShuttingDownDelegate d in handler.GetInvocationList()) | ||
2231 | { | ||
2232 | try | ||
2233 | { | ||
2234 | d(s); | ||
2235 | } | ||
2236 | catch (Exception e) | ||
2237 | { | ||
2238 | m_log.ErrorFormat( | ||
2239 | "[EVENT MANAGER]: Delegate for TriggerSceneShuttingDown failed - continuing. {0} {1}", | ||
2240 | e.Message, e.StackTrace); | ||
2241 | } | ||
2242 | } | ||
2243 | } | ||
2244 | } | ||
2220 | } | 2245 | } |
2221 | } | 2246 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1d2092e..5085396 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1091,6 +1091,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1091 | shuttingdown = true; | 1091 | shuttingdown = true; |
1092 | 1092 | ||
1093 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1093 | m_log.Debug("[SCENE]: Persisting changed objects"); |
1094 | EventManager.TriggerSceneShuttingDown(this); | ||
1095 | |||
1094 | EntityBase[] entities = GetEntities(); | 1096 | EntityBase[] entities = GetEntities(); |
1095 | foreach (EntityBase entity in entities) | 1097 | foreach (EntityBase entity in entities) |
1096 | { | 1098 | { |