diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 35a0200..79a6e09 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -109,6 +109,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
109 | private bool m_KillTimedOutScripts; | 109 | private bool m_KillTimedOutScripts; |
110 | private string m_ScriptEnginesPath = null; | 110 | private string m_ScriptEnginesPath = null; |
111 | 111 | ||
112 | private ExpiringCache<UUID, bool> m_runFlags = new ExpiringCache<UUID, bool>(); | ||
113 | |||
112 | /// <summary> | 114 | /// <summary> |
113 | /// Is the entire simulator in the process of shutting down? | 115 | /// Is the entire simulator in the process of shutting down? |
114 | /// </summary> | 116 | /// </summary> |
@@ -715,6 +717,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
715 | m_Scene.EventManager.OnGetScriptRunning += OnGetScriptRunning; | 717 | m_Scene.EventManager.OnGetScriptRunning += OnGetScriptRunning; |
716 | m_Scene.EventManager.OnShutdown += OnShutdown; | 718 | m_Scene.EventManager.OnShutdown += OnShutdown; |
717 | 719 | ||
720 | // If region ready has been triggered, then the region had no scripts to compile and completed its other | ||
721 | // work. | ||
722 | m_Scene.EventManager.OnRegionReady += s => m_InitialStartup = false; | ||
723 | |||
718 | if (m_SleepTime > 0) | 724 | if (m_SleepTime > 0) |
719 | { | 725 | { |
720 | m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoMaintenance), | 726 | m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoMaintenance), |
@@ -1269,7 +1275,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1269 | 1275 | ||
1270 | if (instance!=null) | 1276 | if (instance!=null) |
1271 | instance.Init(); | 1277 | instance.Init(); |
1272 | 1278 | ||
1279 | bool runIt; | ||
1280 | if (m_runFlags.TryGetValue(itemID, out runIt)) | ||
1281 | { | ||
1282 | if (!runIt) | ||
1283 | StopScript(itemID); | ||
1284 | m_runFlags.Remove(itemID); | ||
1285 | } | ||
1286 | |||
1273 | return true; | 1287 | return true; |
1274 | } | 1288 | } |
1275 | 1289 | ||
@@ -1660,6 +1674,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1660 | IScriptInstance instance = GetInstance(itemID); | 1674 | IScriptInstance instance = GetInstance(itemID); |
1661 | if (instance != null) | 1675 | if (instance != null) |
1662 | instance.Start(); | 1676 | instance.Start(); |
1677 | else | ||
1678 | m_runFlags.AddOrUpdate(itemID, true, 240); | ||
1663 | } | 1679 | } |
1664 | 1680 | ||
1665 | public void StopScript(UUID itemID) | 1681 | public void StopScript(UUID itemID) |
@@ -1671,6 +1687,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1671 | // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort. | 1687 | // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort. |
1672 | instance.Stop(1000); | 1688 | instance.Stop(1000); |
1673 | } | 1689 | } |
1690 | else | ||
1691 | { | ||
1692 | m_runFlags.AddOrUpdate(itemID, false, 240); | ||
1693 | } | ||
1674 | } | 1694 | } |
1675 | 1695 | ||
1676 | public DetectParams GetDetectParams(UUID itemID, int idx) | 1696 | public DetectParams GetDetectParams(UUID itemID, int idx) |