mirror of
https://github.com/opensim/opensim.git
synced 2026-05-16 03:36:04 +08:00
From: Michael Osias <mosias@us.ibm.com>
This patch implements the llSendRemoteData command and fixes mantis 552, and possibly 586.
This commit is contained in:
@@ -125,8 +125,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
comms.DeleteListener(itemID);
|
||||
|
||||
IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||
xmlrpc.DeleteChannel(itemID);
|
||||
xmlrpc.DeleteChannels(itemID);
|
||||
|
||||
xmlrpc.CancelSRDRequests(itemID);
|
||||
|
||||
}
|
||||
|
||||
#region TIMER
|
||||
@@ -238,24 +240,29 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
// implemented here yet anyway. Should be fixed if/when maxsize
|
||||
// is supported
|
||||
|
||||
object[] resobj = new object[]
|
||||
if (m_ScriptEngine.m_ScriptManager.GetScript(httpInfo.localID, httpInfo.itemID) != null)
|
||||
{
|
||||
iHttpReq.RemoveCompletedRequest(httpInfo.reqID);
|
||||
object[] resobj = new object[]
|
||||
{
|
||||
httpInfo.reqID.ToString(), httpInfo.status, null, httpInfo.response_body
|
||||
};
|
||||
|
||||
m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
|
||||
httpInfo.localID, httpInfo.itemID, "http_response", EventQueueManager.llDetectNull, resobj
|
||||
m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
|
||||
httpInfo.localID, httpInfo.itemID, "http_response", EventQueueManager.llDetectNull, resobj
|
||||
);
|
||||
|
||||
httpInfo.Stop();
|
||||
httpInfo = null;
|
||||
}
|
||||
|
||||
httpInfo = iHttpReq.GetNextCompletedRequest();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Check llRemoteData channels
|
||||
|
||||
public void CheckXMLRPCRequests()
|
||||
{
|
||||
if (m_ScriptEngine.World == null)
|
||||
@@ -265,47 +272,96 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
|
||||
if (xmlrpc != null)
|
||||
{
|
||||
while (xmlrpc.hasRequests())
|
||||
{
|
||||
RPCRequestInfo rInfo = xmlrpc.GetNextRequest();
|
||||
//Console.WriteLine("PICKED REQUEST");
|
||||
RPCRequestInfo rInfo = xmlrpc.GetNextCompletedRequest();
|
||||
|
||||
//Deliver data to prim's remote_data handler
|
||||
object[] resobj = new object[]
|
||||
while (rInfo != null)
|
||||
{
|
||||
if (m_ScriptEngine.m_ScriptManager.GetScript(rInfo.GetLocalID(), rInfo.GetItemID()) != null)
|
||||
{
|
||||
xmlrpc.RemoveCompletedRequest(rInfo.GetMessageID());
|
||||
|
||||
//Deliver data to prim's remote_data handler
|
||||
object[] resobj = new object[]
|
||||
{
|
||||
2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), String.Empty,
|
||||
rInfo.GetIntValue(),
|
||||
rInfo.GetStrVal()
|
||||
};
|
||||
m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
|
||||
rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", EventQueueManager.llDetectNull, resobj
|
||||
m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
|
||||
rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", EventQueueManager.llDetectNull, resobj
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
rInfo = xmlrpc.GetNextCompletedRequest();
|
||||
|
||||
}
|
||||
|
||||
SendRemoteDataRequest srdInfo = xmlrpc.GetNextCompletedSRDRequest();
|
||||
|
||||
while (srdInfo != null)
|
||||
{
|
||||
if (m_ScriptEngine.m_ScriptManager.GetScript(srdInfo.m_localID, srdInfo.m_itemID) != null)
|
||||
{
|
||||
xmlrpc.RemoveCompletedSRDRequest(srdInfo.GetReqID());
|
||||
|
||||
//Deliver data to prim's remote_data handler
|
||||
object[] resobj = new object[]
|
||||
{
|
||||
3, srdInfo.channel.ToString(), srdInfo.GetReqID().ToString(), String.Empty,
|
||||
srdInfo.idata,
|
||||
srdInfo.sdata
|
||||
};
|
||||
m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
|
||||
srdInfo.m_localID, srdInfo.m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
srdInfo = xmlrpc.GetNextCompletedSRDRequest();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Check llListeners
|
||||
|
||||
public void CheckListeners()
|
||||
{
|
||||
if (m_ScriptEngine.World == null)
|
||||
return;
|
||||
IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
|
||||
while (comms.HasMessages())
|
||||
if (comms != null)
|
||||
{
|
||||
ListenerInfo lInfo = comms.GetNextMessage();
|
||||
|
||||
//Deliver data to prim's listen handler
|
||||
object[] resobj = new object[]
|
||||
while (comms.HasMessages())
|
||||
{
|
||||
if (m_ScriptEngine.m_ScriptManager.GetScript(
|
||||
comms.PeekNextMessageLocalID(), comms.PeekNextMessageItemID()) != null)
|
||||
{
|
||||
lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage()
|
||||
};
|
||||
ListenerInfo lInfo = comms.GetNextMessage();
|
||||
|
||||
m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
|
||||
lInfo.GetLocalID(), lInfo.GetItemID(), "listen", EventQueueManager.llDetectNull, resobj
|
||||
);
|
||||
//Deliver data to prim's listen handler
|
||||
object[] resobj = new object[]
|
||||
{
|
||||
lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage()
|
||||
};
|
||||
|
||||
m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
|
||||
lInfo.GetLocalID(), lInfo.GetItemID(), "listen", EventQueueManager.llDetectNull, resobj
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// If set to true then threads and stuff should try to make a graceful exit
|
||||
/// </summary>
|
||||
@@ -317,4 +373,4 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
private bool _PleaseShutdown = false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
private Queue<LUStruct> LUQueue = new Queue<LUStruct>();
|
||||
private static bool PrivateThread;
|
||||
private int LoadUnloadMaxQueueSize;
|
||||
private Object scriptLock = new Object();
|
||||
|
||||
// Load/Unload structure
|
||||
private struct LUStruct
|
||||
@@ -304,7 +305,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
//ScriptBaseInterface Script = (ScriptBaseInterface)GetScript(localID, itemID);
|
||||
IScript Script = GetScript(localID, itemID);
|
||||
if (Script == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//cfk 2-7-08 dont need this right now and the default Linux build has DEBUG defined
|
||||
///#if DEBUG
|
||||
/// Console.WriteLine("ScriptEngine: Executing event: " + FunctionName);
|
||||
@@ -331,37 +334,42 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
|
||||
public IScript GetScript(uint localID, LLUUID itemID)
|
||||
{
|
||||
if (Scripts.ContainsKey(localID) == false)
|
||||
return null;
|
||||
lock (scriptLock)
|
||||
{
|
||||
if (Scripts.ContainsKey(localID) == false)
|
||||
return null;
|
||||
|
||||
Dictionary<LLUUID, IScript> Obj;
|
||||
Scripts.TryGetValue(localID, out Obj);
|
||||
if (Obj.ContainsKey(itemID) == false)
|
||||
return null;
|
||||
Dictionary<LLUUID, IScript> Obj;
|
||||
Scripts.TryGetValue(localID, out Obj);
|
||||
if (Obj.ContainsKey(itemID) == false)
|
||||
return null;
|
||||
|
||||
// Get script
|
||||
IScript Script;
|
||||
Obj.TryGetValue(itemID, out Script);
|
||||
|
||||
return Script;
|
||||
// Get script
|
||||
IScript Script;
|
||||
Obj.TryGetValue(itemID, out Script);
|
||||
return Script;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetScript(uint localID, LLUUID itemID, IScript Script)
|
||||
{
|
||||
// Create object if it doesn't exist
|
||||
if (Scripts.ContainsKey(localID) == false)
|
||||
lock (scriptLock)
|
||||
{
|
||||
Scripts.Add(localID, new Dictionary<LLUUID, IScript>());
|
||||
// Create object if it doesn't exist
|
||||
if (Scripts.ContainsKey(localID) == false)
|
||||
{
|
||||
Scripts.Add(localID, new Dictionary<LLUUID, IScript>());
|
||||
}
|
||||
|
||||
// Delete script if it exists
|
||||
Dictionary<LLUUID, IScript> Obj;
|
||||
Scripts.TryGetValue(localID, out Obj);
|
||||
if (Obj.ContainsKey(itemID) == true)
|
||||
Obj.Remove(itemID);
|
||||
|
||||
// Add to object
|
||||
Obj.Add(itemID, Script);
|
||||
}
|
||||
|
||||
// Delete script if it exists
|
||||
Dictionary<LLUUID, IScript> Obj;
|
||||
Scripts.TryGetValue(localID, out Obj);
|
||||
if (Obj.ContainsKey(itemID) == true)
|
||||
Obj.Remove(itemID);
|
||||
|
||||
// Add to object
|
||||
Obj.Add(itemID, Script);
|
||||
}
|
||||
|
||||
public void RemoveScript(uint localID, LLUUID itemID)
|
||||
|
||||
Reference in New Issue
Block a user