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,16 +46,23 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
return;
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();
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
);
}
rInfo = xmlrpc.GetNextCompletedRequest();
handled = true;
}
}
SendRemoteDataRequest srdInfo = xmlrpc.GetNextCompletedSRDRequest();
while (srdInfo != null)
if (! handled)
{
if (m_CmdManager.m_ScriptEngine.m_ScriptManager.GetScript(srdInfo.m_localID, srdInfo.m_itemID) != null)
{
xmlrpc.RemoveCompletedSRDRequest(srdInfo.GetReqID());
Console.WriteLine("Unhandled xml_request: " + rInfo.GetItemID());
}
rInfo = xmlrpc.GetNextCompletedRequest();
}
// Process the send queue
SendRemoteDataRequest srdInfo = xmlrpc.GetNextCompletedSRDRequest();
while (srdInfo != 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());
// 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
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();
}
}
}