From f2d60976d0875c47398ff76ef9de192cc8f3fb02 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Sun, 14 Sep 2008 00:47:45 +0000 Subject: [PATCH] Mantis#2183. Thank you kindly, Ewe Loon for a patch that addresses: after using llTakeControls my sim receives about 200 messages per second, l of which get queued , this could be because there is no lag as the viewer and sim are on the same computer. The patch I have included checks to see if the "Changed" param is 0 then searches the EventQueue for Control messages being sent to the same localid, if it finds a message already in the Queue and Changed==0 then the new message is only notifing you the key is being held, since there is already a message the new one isnt needed so it isnt added to the queue. --- .../Common/ScriptEngineBase/EventManager.cs | 1 + .../ScriptEngineBase/EventQueueManager.cs | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index 89d7045cbf..5a9385f5d8 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs @@ -357,6 +357,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase public void control(uint localID, UUID itemID, UUID agentID, uint held, uint change) { + if ((change == 0) && (myScriptEngine.m_EventQueueManager.CheckEeventQueueForEvent(localID,"control"))) return; myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "control", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLString(agentID.ToString()), new LSL_Types.LSLInteger(held), new LSL_Types.LSLInteger(change)}); } diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs index 1a08795238..af7fca3969 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs @@ -288,6 +288,31 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } } #endregion + + #region " Check execution queue for a specified Event" + /// + /// checks to see if a specified event type is already in the queue + /// + /// Region object ID + /// Name of the function, will be state + "_event_" + FunctionName + /// true if event is found , false if not found + /// + public bool CheckEeventQueueForEvent(uint localID, string FunctionName) + { + if (eventQueue.Count > 0) + { + lock (eventQueue) + { + foreach (EventQueueManager.QueueItemStruct QIS in eventQueue) + { + if ((QIS.functionName == FunctionName) && (QIS.localID == localID)) + return true; + } + } + } + return false; + } + #endregion #region " Add events to execution queue " ///