aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/YEngine
diff options
context:
space:
mode:
authorUbitUmarov2019-11-11 12:51:09 +0000
committerUbitUmarov2019-11-11 12:51:09 +0000
commite87dfd48bf501a16ffd418138a5fff10e7de7c53 (patch)
tree4106605e12e924b80da1787c7a37fde3c62a64dd /OpenSim/Region/ScriptEngine/YEngine
parentterraforming changes: try recover llmodifyland previus behaviur (diff)
downloadopensim-SC-e87dfd48bf501a16ffd418138a5fff10e7de7c53.zip
opensim-SC-e87dfd48bf501a16ffd418138a5fff10e7de7c53.tar.gz
opensim-SC-e87dfd48bf501a16ffd418138a5fff10e7de7c53.tar.bz2
opensim-SC-e87dfd48bf501a16ffd418138a5fff10e7de7c53.tar.xz
Yengine: we also need to cancel timer events in queue, because some bad scripts that do work on X
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs31
2 files changed, 43 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs b/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs
index f30ecc8..d2b4ebd 100644
--- a/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs
+++ b/OpenSim/Region/ScriptEngine/YEngine/XMREngine.cs
@@ -854,7 +854,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
854 public bool PostScriptEvent(UUID itemID, EventParams parms) 854 public bool PostScriptEvent(UUID itemID, EventParams parms)
855 { 855 {
856 XMRInstance instance = GetInstance(itemID); 856 XMRInstance instance = GetInstance(itemID);
857 if(instance == null) 857 if (instance == null)
858 return false; 858 return false;
859 859
860 TraceCalls("[YEngine]: YEngine.PostScriptEvent({0},{1})", itemID.ToString(), parms.EventName); 860 TraceCalls("[YEngine]: YEngine.PostScriptEvent({0},{1})", itemID.ToString(), parms.EventName);
@@ -863,6 +863,17 @@ namespace OpenSim.Region.ScriptEngine.Yengine
863 return true; 863 return true;
864 } 864 }
865 865
866 public void CancelScriptEvent(UUID itemID, string eventName)
867 {
868 XMRInstance instance = GetInstance(itemID);
869 if (instance == null)
870 return;
871
872 TraceCalls("[YEngine]: YEngine.CancelScriptEvent({0},{1})", itemID.ToString(), eventName);
873
874 instance.CancelEvent(eventName);
875 }
876
866 // Events targeted at all scripts in the given prim. 877 // Events targeted at all scripts in the given prim.
867 // localID = which prim 878 // localID = which prim
868 // parms = event to post 879 // parms = event to post
diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs
index 30e397b..57b9e2d 100644
--- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs
+++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs
@@ -237,6 +237,37 @@ namespace OpenSim.Region.ScriptEngine.Yengine
237 } 237 }
238 } 238 }
239 239
240 public void CancelEvent(string eventName)
241 {
242 ScriptEventCode evc;
243 try
244 {
245 evc = (ScriptEventCode)Enum.Parse(typeof(ScriptEventCode), eventName);
246 }
247 catch
248 {
249 return;
250 }
251
252 lock (m_QueueLock)
253 {
254 if(m_EventQueue.Count == 0)
255 return;
256
257 LinkedListNode<EventParams> lln2 = null;
258 for (lln2 = m_EventQueue.First; lln2 != null; lln2 = lln2.Next)
259 {
260 EventParams evt2 = lln2.Value;
261 if(evt2.EventName.Equals(eventName))
262 {
263 m_EventQueue.Remove(lln2);
264 if (evc >= 0 && m_EventCounts[(int)evc] > 0)
265 m_EventCounts[(int)evc]--;
266 }
267 }
268 }
269 }
270
240 // This is called in the script thread to step script until it calls 271 // This is called in the script thread to step script until it calls
241 // CheckRun(). It returns what the instance's next state should be, 272 // CheckRun(). It returns what the instance's next state should be,
242 // ONSLEEPQ, ONYIELDQ, SUSPENDED or FINISHED. 273 // ONSLEEPQ, ONYIELDQ, SUSPENDED or FINISHED.