diff options
author | Melanie Thielker | 2008-09-25 05:13:44 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-25 05:13:44 +0000 |
commit | f3c8963c86dbc969541ede80ae37eb59d26b7809 (patch) | |
tree | ff1e5cea74e9d5c2b73c476320a7bddf11d93766 /OpenSim/Region/ScriptEngine/XEngine | |
parent | Mantis#2123. Thank you kindly, Idb for a patch that solves: (diff) | |
download | opensim-SC-f3c8963c86dbc969541ede80ae37eb59d26b7809.zip opensim-SC-f3c8963c86dbc969541ede80ae37eb59d26b7809.tar.gz opensim-SC-f3c8963c86dbc969541ede80ae37eb59d26b7809.tar.bz2 opensim-SC-f3c8963c86dbc969541ede80ae37eb59d26b7809.tar.xz |
Convergence is almost complete. This brings the diff between the API to < 10k
and makes it use a common set of types in both engine. Fixes the issues with
running both engines and HTTP requests / listens / timers etc..
Also fixes a couple of minor Scene issues and a CTB by nullref.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index f4cfef0..701ad60 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -50,7 +50,7 @@ using OpenSim.Region.ScriptEngine.Interfaces; | |||
50 | 50 | ||
51 | namespace OpenSim.Region.ScriptEngine.XEngine | 51 | namespace OpenSim.Region.ScriptEngine.XEngine |
52 | { | 52 | { |
53 | public class XEngine : IScriptModule, IScriptEngine | 53 | public class XEngine : IRegionModule, IScriptEngine |
54 | { | 54 | { |
55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
56 | 56 | ||
@@ -75,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
75 | #pragma warning restore 414 | 75 | #pragma warning restore 414 |
76 | private int m_EventLimit; | 76 | private int m_EventLimit; |
77 | private bool m_KillTimedOutScripts; | 77 | private bool m_KillTimedOutScripts; |
78 | bool m_firstStart = true; | 78 | // bool m_firstStart = true; |
79 | 79 | ||
80 | private static List<XEngine> m_ScriptEngines = | 80 | private static List<XEngine> m_ScriptEngines = |
81 | new List<XEngine>(); | 81 | new List<XEngine>(); |
@@ -205,8 +205,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
205 | m_ScriptEngines.Add(this); | 205 | m_ScriptEngines.Add(this); |
206 | } | 206 | } |
207 | 207 | ||
208 | scene.RegisterModuleInterface<IScriptModule>(this); | ||
209 | |||
210 | // Needs to be here so we can queue the scripts that need starting | 208 | // Needs to be here so we can queue the scripts that need starting |
211 | // | 209 | // |
212 | m_Scene.EventManager.OnRezScript += OnRezScript; | 210 | m_Scene.EventManager.OnRezScript += OnRezScript; |
@@ -230,6 +228,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
230 | m_Scene.EventManager.OnScriptReset += OnScriptReset; | 228 | m_Scene.EventManager.OnScriptReset += OnScriptReset; |
231 | m_Scene.EventManager.OnStartScript += OnStartScript; | 229 | m_Scene.EventManager.OnStartScript += OnStartScript; |
232 | m_Scene.EventManager.OnStopScript += OnStopScript; | 230 | m_Scene.EventManager.OnStopScript += OnStopScript; |
231 | m_Scene.EventManager.OnGetScriptRunning += OnGetScriptRunning; | ||
233 | m_Scene.EventManager.OnShutdown += OnShutdown; | 232 | m_Scene.EventManager.OnShutdown += OnShutdown; |
234 | 233 | ||
235 | if (m_SleepTime > 0) | 234 | if (m_SleepTime > 0) |
@@ -357,14 +356,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
357 | 356 | ||
358 | if (m_CurrentCompile == null) | 357 | if (m_CurrentCompile == null) |
359 | { | 358 | { |
360 | if (m_firstStart) | 359 | // if (m_firstStart) |
361 | { | 360 | // { |
362 | m_firstStart = false; | 361 | // m_firstStart = false; |
363 | m_CurrentCompile = m_ThreadPool.QueueWorkItem( | 362 | // m_CurrentCompile = m_ThreadPool.QueueWorkItem( |
364 | new WorkItemCallback(this.DoScriptWait), | 363 | // new WorkItemCallback(this.DoScriptWait), |
365 | new Object[0]); | 364 | // new Object[0]); |
366 | return; | 365 | // return; |
367 | } | 366 | // } |
368 | 367 | ||
369 | m_CurrentCompile = m_ThreadPool.QueueWorkItem( | 368 | m_CurrentCompile = m_ThreadPool.QueueWorkItem( |
370 | new WorkItemCallback(this.DoOnRezScriptQueue), | 369 | new WorkItemCallback(this.DoOnRezScriptQueue), |
@@ -375,7 +374,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
375 | 374 | ||
376 | public Object DoScriptWait(Object dummy) | 375 | public Object DoScriptWait(Object dummy) |
377 | { | 376 | { |
378 | Thread.Sleep(30000); | 377 | Thread.Sleep(10000); |
379 | 378 | ||
380 | lock (m_CompileQueue) | 379 | lock (m_CompileQueue) |
381 | { | 380 | { |
@@ -884,11 +883,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
884 | return instance.StartParam; | 883 | return instance.StartParam; |
885 | } | 884 | } |
886 | 885 | ||
887 | public bool GetScriptRunning(UUID objectID, UUID itemID) | ||
888 | { | ||
889 | return GetScriptState(itemID); | ||
890 | } | ||
891 | |||
892 | public void OnShutdown() | 886 | public void OnShutdown() |
893 | { | 887 | { |
894 | List<IScriptInstance> instances = new List<IScriptInstance>(); | 888 | List<IScriptInstance> instances = new List<IScriptInstance>(); |
@@ -922,5 +916,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
922 | return null; | 916 | return null; |
923 | return instance.GetApi(name); | 917 | return instance.GetApi(name); |
924 | } | 918 | } |
919 | |||
920 | public void OnGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) | ||
921 | { | ||
922 | IScriptInstance instance = GetInstance(itemID); | ||
923 | if (instance == null) | ||
924 | return; | ||
925 | controllingClient.SendScriptRunningReply(objectID, itemID, | ||
926 | GetScriptState(itemID)); | ||
927 | } | ||
925 | } | 928 | } |
926 | } | 929 | } |