From c489bc1cd2c81273aaf0e0beb23b3714079ce4be Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 17 Jul 2012 15:00:42 +0200 Subject: Make the scrpt running flag work properly --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 01aebb6..7a9c80c 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -108,6 +108,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine private bool m_KillTimedOutScripts; private string m_ScriptEnginesPath = null; + private ExpiringCache m_runFlags = new ExpiringCache(); + /// /// Is the entire simulator in the process of shutting down? /// @@ -1196,6 +1198,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (instance != null) instance.Init(); + bool runIt; + if (m_runFlags.TryGetValue(itemID, out runIt)) + { + if (!runIt) + StopScript(itemID); + m_runFlags.Remove(itemID); + } + return true; } @@ -1568,6 +1578,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine IScriptInstance instance = GetInstance(itemID); if (instance != null) instance.Start(); + else + m_runFlags.AddOrUpdate(itemID, true, 240); } public void StopScript(UUID itemID) @@ -1579,6 +1591,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort. instance.Stop(1000); } + else + { + m_runFlags.AddOrUpdate(itemID, false, 240); + } } public DetectParams GetDetectParams(UUID itemID, int idx) -- cgit v1.1 From 1971b6bb4f0f15c08dedee95e730ff6485d8c7cf Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Jul 2012 22:24:52 +0100 Subject: Stop the 15 second initial script compile wait if a script is being rezzed on a previously empty region. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 7a9c80c..da344d6 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -644,6 +644,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine m_Scene.EventManager.OnGetScriptRunning += OnGetScriptRunning; m_Scene.EventManager.OnShutdown += OnShutdown; + // If region ready has been triggered, then the region had no scripts to compile and completed its other + // work. + m_Scene.EventManager.OnRegionReady += s => m_InitialStartup = false; + if (m_SleepTime > 0) { m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoMaintenance), -- 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/ScriptEngine/XEngine/XEngine.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index da344d6..2dba029 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -646,7 +646,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine // If region ready has been triggered, then the region had no scripts to compile and completed its other // work. - m_Scene.EventManager.OnRegionReady += s => m_InitialStartup = false; + m_Scene.EventManager.OnRegionReadyStatusChange += s => { if (s.Ready) m_InitialStartup = false; }; if (m_SleepTime > 0) { -- cgit v1.1