From 6460e587c470361173291337ad222f48c13a10ce Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Jul 2012 21:29:12 +0100 Subject: Pass entire scene object in OnLoginsEnabled event rather than just the region name. This saves listeners from having to re-retrieve the scene from their own lists, which won't work anyway if multiple regions with the same name have been allowed --- OpenSim/Region/Framework/Scenes/EventManager.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index f92ed8e..e2380b7 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -496,14 +496,13 @@ namespace OpenSim.Region.Framework.Scenes public delegate void RegionHeartbeatEnd(Scene scene); public event RegionHeartbeatEnd OnRegionHeartbeatEnd; - public delegate void LoginsEnabled(string regionName); - /// /// This should only fire in all circumstances if the RegionReady module is active. /// /// /// TODO: Fire this even when the RegionReady module is not active. /// + public delegate void LoginsEnabled(IScene scene); public event LoginsEnabled OnLoginsEnabled; public delegate void PrimsLoaded(Scene s); @@ -2477,7 +2476,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerLoginsEnabled (string regionName) + public void TriggerLoginsEnabled(Scene scene) { LoginsEnabled handler = OnLoginsEnabled; @@ -2487,7 +2486,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - d(regionName); + d(scene); } catch (Exception e) { -- cgit v1.1 From 4973fddc51a4a9e3952bd2decd0ea1842b742141 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Jul 2012 21:52:07 +0100 Subject: Establish EventManager.OnRegionReady event. This will only be triggerred once when the region is ready. Switch MapImageServiceModule to use this. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 37 +++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index e2380b7..714d70d 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -505,6 +505,16 @@ namespace OpenSim.Region.Framework.Scenes public delegate void LoginsEnabled(IScene scene); public event LoginsEnabled OnLoginsEnabled; + /// + /// Fired when a region is considered ready for use. + /// + /// + /// A region is considered ready when startup operations such as loading of scripts already on the region + /// have been completed. + /// + public delegate void RegionReady(IScene scene); + public event RegionReady OnRegionReady; + public delegate void PrimsLoaded(Scene s); public event PrimsLoaded OnPrimsLoaded; @@ -2476,11 +2486,11 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerLoginsEnabled(Scene scene) + public void TriggerLoginsEnabled(IScene scene) { LoginsEnabled handler = OnLoginsEnabled; - if ( handler != null) + if (handler != null) { foreach (LoginsEnabled d in handler.GetInvocationList()) { @@ -2490,7 +2500,28 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.ErrorFormat("[EVENT MANAGER]: Delegate for LoginsEnabled failed - continuing {0} - {1}", + m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnLoginsEnabled failed - continuing {0} - {1}", + e.Message, e.StackTrace); + } + } + } + } + + public void TriggerRegionReady(IScene scene) + { + RegionReady handler = OnRegionReady; + + if (handler != null) + { + foreach (RegionReady d in handler.GetInvocationList()) + { + try + { + d(scene); + } + catch (Exception e) + { + m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReady failed - continuing {0} - {1}", e.Message, e.StackTrace); } } -- cgit v1.1 From 528004d34988d8d2349f18ff7d78c6dd50ab8b2d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Jul 2012 23:35:05 +0100 Subject: Perform other region ready actions even if simulator is configured to leave logins disabled on startup. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 714d70d..b8ae0ac 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -2506,7 +2506,7 @@ namespace OpenSim.Region.Framework.Scenes } } } - + public void TriggerRegionReady(IScene scene) { RegionReady handler = OnRegionReady; -- cgit v1.1 From 6dda7c65ae1d58cac3e8dc2d9d64f56c870df39e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 19 Jul 2012 00:09:22 +0100 Subject: Add EventManager.OnRegionLoginsStatusChange fired whenever logins are enabled or disabled at any point, not just during initial startup. This replaces EventManager.OnLoginsEnabled which only fired when logins were first enabled and was affected by a bug where it would never fire if the region started with logins disabled. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index b8ae0ac..620b605 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -497,13 +497,14 @@ namespace OpenSim.Region.Framework.Scenes public event RegionHeartbeatEnd OnRegionHeartbeatEnd; /// - /// This should only fire in all circumstances if the RegionReady module is active. + /// Fired when logins to a region are enabled or disabled. /// /// - /// TODO: Fire this even when the RegionReady module is not active. + /// /// - public delegate void LoginsEnabled(IScene scene); - public event LoginsEnabled OnLoginsEnabled; + /// Fired + public event RegionLoginsStatusChange OnRegionLoginsStatusChange; + public delegate void RegionLoginsStatusChange(IScene scene); /// /// Fired when a region is considered ready for use. @@ -512,8 +513,8 @@ namespace OpenSim.Region.Framework.Scenes /// A region is considered ready when startup operations such as loading of scripts already on the region /// have been completed. /// - public delegate void RegionReady(IScene scene); public event RegionReady OnRegionReady; + public delegate void RegionReady(IScene scene); public delegate void PrimsLoaded(Scene s); public event PrimsLoaded OnPrimsLoaded; @@ -2486,13 +2487,13 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerLoginsEnabled(IScene scene) + public void TriggerRegionLoginsStatusChange(IScene scene) { - LoginsEnabled handler = OnLoginsEnabled; + RegionLoginsStatusChange handler = OnRegionLoginsStatusChange; if (handler != null) { - foreach (LoginsEnabled d in handler.GetInvocationList()) + foreach (RegionLoginsStatusChange d in handler.GetInvocationList()) { try { @@ -2500,13 +2501,13 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnLoginsEnabled failed - continuing {0} - {1}", + m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionLoginsStatusChange failed - continuing {0} - {1}", e.Message, e.StackTrace); } } } } - + public void TriggerRegionReady(IScene scene) { RegionReady handler = OnRegionReady; -- cgit v1.1 From 31304c222df1e5a832afd0ebcf7d3ed403543e54 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 25 Jul 2012 21:00:59 +0100 Subject: Make SceneManager.OnRegionsReadyStatusChange event available. This is fired when all regions are ready or when at least one region becomes not ready. Recently added EventManager.OnRegionReady becomes OnRegionReadyStatusChange to match OnLoginsEnabledStatusChange --- OpenSim/Region/Framework/Scenes/EventManager.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 620b605..6dea2f0 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -513,8 +513,7 @@ namespace OpenSim.Region.Framework.Scenes /// A region is considered ready when startup operations such as loading of scripts already on the region /// have been completed. /// - public event RegionReady OnRegionReady; - public delegate void RegionReady(IScene scene); + public event Action OnRegionReadyStatusChange; public delegate void PrimsLoaded(Scene s); public event PrimsLoaded OnPrimsLoaded; @@ -2508,13 +2507,13 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerRegionReady(IScene scene) + public void TriggerRegionReadyStatusChange(IScene scene) { - RegionReady handler = OnRegionReady; + Action handler = OnRegionReadyStatusChange; if (handler != null) { - foreach (RegionReady d in handler.GetInvocationList()) + foreach (Action d in handler.GetInvocationList()) { try { @@ -2522,7 +2521,7 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReady failed - continuing {0} - {1}", + m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReadyStatusChange failed - continuing {0} - {1}", e.Message, e.StackTrace); } } -- cgit v1.1