aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
diff options
context:
space:
mode:
authorCharles Krinke2008-06-05 14:15:15 +0000
committerCharles Krinke2008-06-05 14:15:15 +0000
commite3c14e9b24350bc4065172ddf6be90116a3a538c (patch)
treeb3c8fe82f7a97f57968e4d69a1e004d0e7f8e52f /OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
parentMantis#1455. Thank you kindly, Mikem for a patch that addresses (diff)
downloadopensim-SC-e3c14e9b24350bc4065172ddf6be90116a3a538c.zip
opensim-SC-e3c14e9b24350bc4065172ddf6be90116a3a538c.tar.gz
opensim-SC-e3c14e9b24350bc4065172ddf6be90116a3a538c.tar.bz2
opensim-SC-e3c14e9b24350bc4065172ddf6be90116a3a538c.tar.xz
Mantis#1437. Patch one of four. Thank you kindly, Melanie for:
Corrects the XEngine's script startup semantics. Completes llRequestAgentData Implements llDetectedLink Fixes a few minor issues
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs54
1 files changed, 34 insertions, 20 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 0fe1f46..2b78df3 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -280,9 +280,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
280 // 280 //
281 public void OnRezScript(uint localID, LLUUID itemID, string script) 281 public void OnRezScript(uint localID, LLUUID itemID, string script)
282 { 282 {
283 m_ThreadPool.QueueWorkItem(new WorkItemCallback( 283// m_ThreadPool.QueueWorkItem(new WorkItemCallback(
284 this.DoOnRezScript), new Object[] 284// this.DoOnRezScript), new Object[]
285 { localID, itemID, script}); 285// { localID, itemID, script});
286 DoOnRezScript(new Object[] { localID, itemID, script});
286 } 287 }
287 288
288 private object DoOnRezScript(object parm) 289 private object DoOnRezScript(object parm)
@@ -346,15 +347,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
346 { 347 {
347 // Create the object record 348 // Create the object record
348 349
349 if (!m_PrimObjects.ContainsKey(localID))
350 m_PrimObjects[localID] = new List<LLUUID>();
351
352 if (!m_PrimObjects[localID].Contains(itemID))
353 m_PrimObjects[localID].Add(itemID);
354
355 if (!m_Assemblies.ContainsKey(assetID))
356 m_Assemblies[assetID] = assembly;
357
358 if ((!m_Scripts.ContainsKey(itemID)) || 350 if ((!m_Scripts.ContainsKey(itemID)) ||
359 (m_Scripts[itemID].AssetID != assetID)) 351 (m_Scripts[itemID].AssetID != assetID))
360 { 352 {
@@ -402,6 +394,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
402 394
403 m_Scripts[itemID] = instance; 395 m_Scripts[itemID] = instance;
404 } 396 }
397
398 if(!m_PrimObjects.ContainsKey(localID))
399 m_PrimObjects[localID] = new List<LLUUID>();
400
401 if(!m_PrimObjects[localID].Contains(itemID))
402 m_PrimObjects[localID].Add(itemID);
403
404 if(!m_Assemblies.ContainsKey(assetID))
405 m_Assemblies[assetID] = assembly;
405 } 406 }
406 return true; 407 return true;
407 } 408 }
@@ -653,7 +654,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
653 XScriptInstance instance = GetInstance(itemID); 654 XScriptInstance instance = GetInstance(itemID);
654 if (instance != null) 655 if (instance != null)
655 return instance.GetDetectParams(idx); 656 return instance.GetDetectParams(idx);
656 return new XDetectParams(); 657 return null;
657 } 658 }
658 659
659 public LLUUID GetDetectID(LLUUID itemID, int idx) 660 public LLUUID GetDetectID(LLUUID itemID, int idx)
@@ -665,10 +666,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
665 } 666 }
666 } 667 }
667 668
668 public struct XDetectParams 669 public class XDetectParams
669 { 670 {
670 public LLUUID Key; 671 public LLUUID Key;
671 public LSL_Types.Vector3 OffsetPos; 672 public LSL_Types.Vector3 OffsetPos;
673 public int LinkNum;
672 } 674 }
673 675
674 public class XEventParams 676 public class XEventParams
@@ -886,6 +888,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
886 { 888 {
887 if (m_CurrentResult == null) 889 if (m_CurrentResult == null)
888 m_CurrentResult = m_Engine.QueueEventHandler(this); 890 m_CurrentResult = m_Engine.QueueEventHandler(this);
891 else
892 m_Engine.Log.Error("[XEngine] Tried to start a script that was already queued");
889 } 893 }
890 } 894 }
891 } 895 }
@@ -923,12 +927,22 @@ namespace OpenSim.Region.ScriptEngine.XEngine
923 927
924 lock (m_EventQueue) 928 lock (m_EventQueue)
925 { 929 {
926 if (m_CurrentResult != null) 930 result = m_CurrentResult;
927 m_CurrentResult.Abort(); 931 }
928 else 932
929 return true; 933 if(result == null)
934 return true;
935
936 if(SmartThreadPool.WaitAll(new IWorkItemResult[] {result}, new TimeSpan((long)10000000), false))
937 {
938 lock(m_EventQueue)
939 {
940 m_CurrentResult = null;
941 }
942 return true;
930 } 943 }
931 944
945 m_Engine.Log.Error("[XEngine] Failed to reliably stop script");
932 return true; 946 return true;
933 } 947 }
934 948
@@ -1109,7 +1123,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1109 public XDetectParams GetDetectParams(int idx) 1123 public XDetectParams GetDetectParams(int idx)
1110 { 1124 {
1111 if (idx < 0 || idx >= m_DetectParams.Length) 1125 if (idx < 0 || idx >= m_DetectParams.Length)
1112 return new XDetectParams(); 1126 return null;
1113 1127
1114 return m_DetectParams[idx]; 1128 return m_DetectParams[idx];
1115 } 1129 }
@@ -1307,7 +1321,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1307 LLUUID.TryParse(det.InnerText, 1321 LLUUID.TryParse(det.InnerText,
1308 out uuid); 1322 out uuid);
1309 1323
1310 XDetectParams d; 1324 XDetectParams d = new XDetectParams();
1311 d.Key = uuid; 1325 d.Key = uuid;
1312 d.OffsetPos = v; 1326 d.OffsetPos = v;
1313 1327