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.
0.6.0-stable
Charles Krinke 2008-05-29 13:42:29 +00:00
parent 3e0244c633
commit 91b75eda85
1 changed files with 48 additions and 19 deletions

View File

@ -46,17 +46,24 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
return; return;
IXMLRPC xmlrpc = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); IXMLRPC xmlrpc = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
if (null == xmlrpc)
return;
if (xmlrpc != null) // Process the completed request queue
{
RPCRequestInfo rInfo = xmlrpc.GetNextCompletedRequest(); RPCRequestInfo rInfo = xmlrpc.GetNextCompletedRequest();
while (rInfo != null) while (rInfo != null)
{ {
if (m_CmdManager.m_ScriptEngine.m_ScriptManager.GetScript(rInfo.GetLocalID(), rInfo.GetItemID()) != null) bool handled = false;
{
// Request must be taken out of the queue in case there is no handler, otherwise we loop infinitely
xmlrpc.RemoveCompletedRequest(rInfo.GetMessageID()); 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 //Deliver data to prim's remote_data handler
object[] resobj = new object[] object[] resobj = new object[]
{ {
@ -64,22 +71,37 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
new LSL_Types.LSLInteger(rInfo.GetIntValue()), new LSL_Types.LSLInteger(rInfo.GetIntValue()),
new LSL_Types.LSLString(rInfo.GetStrVal()) 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 rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", EventQueueManager.llDetectNull, resobj
); );
handled = true;
}
}
if (! handled)
{
Console.WriteLine("Unhandled xml_request: " + rInfo.GetItemID());
} }
rInfo = xmlrpc.GetNextCompletedRequest(); rInfo = xmlrpc.GetNextCompletedRequest();
} }
// Process the send queue
SendRemoteDataRequest srdInfo = xmlrpc.GetNextCompletedSRDRequest(); SendRemoteDataRequest srdInfo = xmlrpc.GetNextCompletedSRDRequest();
while (srdInfo != null) while (srdInfo != null)
{ {
if (m_CmdManager.m_ScriptEngine.m_ScriptManager.GetScript(srdInfo.m_localID, srdInfo.m_itemID) != null) bool handled = false;
{
// Request must be taken out of the queue in case there is no handler, otherwise we loop infinitely
xmlrpc.RemoveCompletedSRDRequest(srdInfo.GetReqID()); 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 (sman.m_ScriptManager.GetScript(srdInfo.m_localID,srdInfo.m_itemID) != null) {
//Deliver data to prim's remote_data handler //Deliver data to prim's remote_data handler
object[] resobj = new object[] object[] resobj = new object[]
{ {
@ -87,14 +109,21 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
new LSL_Types.LSLInteger(srdInfo.idata), new LSL_Types.LSLInteger(srdInfo.idata),
new LSL_Types.LSLString(srdInfo.sdata) 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.m_localID, srdInfo.m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj
); );
handled = true;
}
}
if (! handled)
{
Console.WriteLine("Unhandled xml_srdrequest: " + srdInfo.GetReqID());
} }
srdInfo = xmlrpc.GetNextCompletedSRDRequest(); srdInfo = xmlrpc.GetNextCompletedSRDRequest();
} }
} }
} }
}
} }