From 91b75eda85d565f4fe4cf7ee844e24d54ef084b6 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Thu, 29 May 2008 13:42:29 +0000 Subject: Mantis#852. Thank you kindly, cmickeyb for a patch that: There appears to be a problem with the mapping of scripts when an llHTTPRequest completes. CheckHttpRequests() looks for a function that maps to the localID associated with the http request. However, the only context in which it looks is that of the first region. That is, m_CmdManager.m_ScriptEngine.m_ScriptManager is the same no matter where the script executed that initiated the llHTTPRequest. Since scripts appear to be loaded into a region specific scriptmanager on startup, the event handler is only found for requests coming from the first region. --- .../AsyncCommandPlugins/XmlRequest.cs | 63 ++++++++++++++++------ 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs index b3e5f3e..c793add 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs @@ -46,16 +46,23 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin return; IXMLRPC xmlrpc = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface(); + if (null == xmlrpc) + return; + + // Process the completed request queue + RPCRequestInfo rInfo = xmlrpc.GetNextCompletedRequest(); - if (xmlrpc != null) + while (rInfo != null) { - RPCRequestInfo rInfo = xmlrpc.GetNextCompletedRequest(); + bool handled = false; - while (rInfo != null) - { - if (m_CmdManager.m_ScriptEngine.m_ScriptManager.GetScript(rInfo.GetLocalID(), rInfo.GetItemID()) != null) - { - xmlrpc.RemoveCompletedRequest(rInfo.GetMessageID()); + // Request must be taken out of the queue in case there is no handler, otherwise we loop infinitely + xmlrpc.RemoveCompletedRequest(rInfo.GetMessageID()); + + // And since the xmlrpc request queue is actually shared among all regions on the simulator, we need + // to look in each one for the appropriate handler + foreach (ScriptEngine sman in ScriptEngine.ScriptEngines) { + if (sman.m_ScriptManager.GetScript(rInfo.GetLocalID(),rInfo.GetItemID()) != null) { //Deliver data to prim's remote_data handler object[] resobj = new object[] @@ -64,21 +71,36 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin new LSL_Types.LSLInteger(rInfo.GetIntValue()), new LSL_Types.LSLString(rInfo.GetStrVal()) }; - m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( + sman.m_EventQueueManager.AddToScriptQueue( rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", EventQueueManager.llDetectNull, resobj ); + + handled = true; } + } - rInfo = xmlrpc.GetNextCompletedRequest(); + if (! handled) + { + Console.WriteLine("Unhandled xml_request: " + rInfo.GetItemID()); } - SendRemoteDataRequest srdInfo = xmlrpc.GetNextCompletedSRDRequest(); + rInfo = xmlrpc.GetNextCompletedRequest(); + } + + // Process the send queue + SendRemoteDataRequest srdInfo = xmlrpc.GetNextCompletedSRDRequest(); + + while (srdInfo != null) + { + bool handled = false; - while (srdInfo != null) + // Request must be taken out of the queue in case there is no handler, otherwise we loop infinitely + xmlrpc.RemoveCompletedSRDRequest(srdInfo.GetReqID()); + + // And this is another shared queue... so we check each of the script engines for a handler + foreach (ScriptEngine sman in ScriptEngine.ScriptEngines) { - if (m_CmdManager.m_ScriptEngine.m_ScriptManager.GetScript(srdInfo.m_localID, srdInfo.m_itemID) != null) - { - xmlrpc.RemoveCompletedSRDRequest(srdInfo.GetReqID()); + if (sman.m_ScriptManager.GetScript(srdInfo.m_localID,srdInfo.m_itemID) != null) { //Deliver data to prim's remote_data handler object[] resobj = new object[] @@ -87,13 +109,20 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin new LSL_Types.LSLInteger(srdInfo.idata), new LSL_Types.LSLString(srdInfo.sdata) }; - m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( + sman.m_EventQueueManager.AddToScriptQueue( srdInfo.m_localID, srdInfo.m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj ); - } - srdInfo = xmlrpc.GetNextCompletedSRDRequest(); + handled = true; + } + } + + if (! handled) + { + Console.WriteLine("Unhandled xml_srdrequest: " + srdInfo.GetReqID()); } + + srdInfo = xmlrpc.GetNextCompletedSRDRequest(); } } } -- cgit v1.1