diff options
author | UbitUmarov | 2019-11-11 12:51:09 +0000 |
---|---|---|
committer | UbitUmarov | 2019-11-11 12:51:09 +0000 |
commit | e87dfd48bf501a16ffd418138a5fff10e7de7c53 (patch) | |
tree | 4106605e12e924b80da1787c7a37fde3c62a64dd | |
parent | terraforming changes: try recover llmodifyland previus behaviur (diff) | |
download | opensim-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
5 files changed, 50 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs index 2e1dbbe..fa20606 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs | |||
@@ -54,6 +54,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
54 | 54 | ||
55 | IScriptModule ScriptModule { get; } | 55 | IScriptModule ScriptModule { get; } |
56 | 56 | ||
57 | void CancelScriptEvent(UUID itemID, string eventName); | ||
57 | /// <summary> | 58 | /// <summary> |
58 | /// Post an event to a single script | 59 | /// Post an event to a single script |
59 | /// </summary> | 60 | /// </summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs index cae1c14..f8dea98 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs | |||
@@ -110,8 +110,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
110 | string key = MakeTimerKey(m_localID, m_itemID); | 110 | string key = MakeTimerKey(m_localID, m_itemID); |
111 | lock (TimerListLock) | 111 | lock (TimerListLock) |
112 | { | 112 | { |
113 | if (Timers.ContainsKey(key)) | 113 | if (Timers.TryGetValue(key, out TimerInfo ts)) |
114 | { | 114 | { |
115 | m_CmdManager.m_ScriptEngine.CancelScriptEvent(ts.itemID, "timer"); | ||
115 | Timers.Remove(key); | 116 | Timers.Remove(key); |
116 | } | 117 | } |
117 | } | 118 | } |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index af82dc8..9e47530 100755 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1794,6 +1794,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1794 | return result; | 1794 | return result; |
1795 | } | 1795 | } |
1796 | 1796 | ||
1797 | public void CancelScriptEvent(UUID itemID, string eventName) | ||
1798 | { | ||
1799 | } | ||
1800 | |||
1797 | /// <summary> | 1801 | /// <summary> |
1798 | /// Post an event to a single script | 1802 | /// Post an event to a single script |
1799 | /// </summary> | 1803 | /// </summary> |
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. |