diff options
author | Charles Krinke | 2008-05-29 13:42:29 +0000 |
---|---|---|
committer | Charles Krinke | 2008-05-29 13:42:29 +0000 |
commit | 91b75eda85d565f4fe4cf7ee844e24d54ef084b6 (patch) | |
tree | a46fe007f2a6e061dd165a12f1774853f79e24c7 /OpenSim/Region/ScriptEngine/Common | |
parent | * Added a child agent check to the ChildAgentData Update to make sure that yo... (diff) | |
download | opensim-SC_OLD-91b75eda85d565f4fe4cf7ee844e24d54ef084b6.zip opensim-SC_OLD-91b75eda85d565f4fe4cf7ee844e24d54ef084b6.tar.gz opensim-SC_OLD-91b75eda85d565f4fe4cf7ee844e24d54ef084b6.tar.bz2 opensim-SC_OLD-91b75eda85d565f4fe4cf7ee844e24d54ef084b6.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs | 63 |
1 files 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 | |||
46 | return; | 46 | return; |
47 | 47 | ||
48 | IXMLRPC xmlrpc = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 48 | IXMLRPC xmlrpc = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
49 | if (null == xmlrpc) | ||
50 | return; | ||
51 | |||
52 | // Process the completed request queue | ||
53 | RPCRequestInfo rInfo = xmlrpc.GetNextCompletedRequest(); | ||
49 | 54 | ||
50 | if (xmlrpc != null) | 55 | while (rInfo != null) |
51 | { | 56 | { |
52 | RPCRequestInfo rInfo = xmlrpc.GetNextCompletedRequest(); | 57 | bool handled = false; |
53 | 58 | ||
54 | while (rInfo != null) | 59 | // Request must be taken out of the queue in case there is no handler, otherwise we loop infinitely |
55 | { | 60 | xmlrpc.RemoveCompletedRequest(rInfo.GetMessageID()); |
56 | if (m_CmdManager.m_ScriptEngine.m_ScriptManager.GetScript(rInfo.GetLocalID(), rInfo.GetItemID()) != null) | 61 | |
57 | { | 62 | // And since the xmlrpc request queue is actually shared among all regions on the simulator, we need |
58 | xmlrpc.RemoveCompletedRequest(rInfo.GetMessageID()); | 63 | // to look in each one for the appropriate handler |
64 | foreach (ScriptEngine sman in ScriptEngine.ScriptEngines) { | ||
65 | if (sman.m_ScriptManager.GetScript(rInfo.GetLocalID(),rInfo.GetItemID()) != null) { | ||
59 | 66 | ||
60 | //Deliver data to prim's remote_data handler | 67 | //Deliver data to prim's remote_data handler |
61 | object[] resobj = new object[] | 68 | object[] resobj = new object[] |
@@ -64,21 +71,36 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin | |||
64 | new LSL_Types.LSLInteger(rInfo.GetIntValue()), | 71 | new LSL_Types.LSLInteger(rInfo.GetIntValue()), |
65 | new LSL_Types.LSLString(rInfo.GetStrVal()) | 72 | new LSL_Types.LSLString(rInfo.GetStrVal()) |
66 | }; | 73 | }; |
67 | m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( | 74 | sman.m_EventQueueManager.AddToScriptQueue( |
68 | rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", EventQueueManager.llDetectNull, resobj | 75 | rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", EventQueueManager.llDetectNull, resobj |
69 | ); | 76 | ); |
77 | |||
78 | handled = true; | ||
70 | } | 79 | } |
80 | } | ||
71 | 81 | ||
72 | rInfo = xmlrpc.GetNextCompletedRequest(); | 82 | if (! handled) |
83 | { | ||
84 | Console.WriteLine("Unhandled xml_request: " + rInfo.GetItemID()); | ||
73 | } | 85 | } |
74 | 86 | ||
75 | SendRemoteDataRequest srdInfo = xmlrpc.GetNextCompletedSRDRequest(); | 87 | rInfo = xmlrpc.GetNextCompletedRequest(); |
88 | } | ||
89 | |||
90 | // Process the send queue | ||
91 | SendRemoteDataRequest srdInfo = xmlrpc.GetNextCompletedSRDRequest(); | ||
92 | |||
93 | while (srdInfo != null) | ||
94 | { | ||
95 | bool handled = false; | ||
76 | 96 | ||
77 | while (srdInfo != null) | 97 | // Request must be taken out of the queue in case there is no handler, otherwise we loop infinitely |
98 | xmlrpc.RemoveCompletedSRDRequest(srdInfo.GetReqID()); | ||
99 | |||
100 | // And this is another shared queue... so we check each of the script engines for a handler | ||
101 | foreach (ScriptEngine sman in ScriptEngine.ScriptEngines) | ||
78 | { | 102 | { |
79 | if (m_CmdManager.m_ScriptEngine.m_ScriptManager.GetScript(srdInfo.m_localID, srdInfo.m_itemID) != null) | 103 | if (sman.m_ScriptManager.GetScript(srdInfo.m_localID,srdInfo.m_itemID) != null) { |
80 | { | ||
81 | xmlrpc.RemoveCompletedSRDRequest(srdInfo.GetReqID()); | ||
82 | 104 | ||
83 | //Deliver data to prim's remote_data handler | 105 | //Deliver data to prim's remote_data handler |
84 | object[] resobj = new object[] | 106 | object[] resobj = new object[] |
@@ -87,13 +109,20 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin | |||
87 | new LSL_Types.LSLInteger(srdInfo.idata), | 109 | new LSL_Types.LSLInteger(srdInfo.idata), |
88 | new LSL_Types.LSLString(srdInfo.sdata) | 110 | new LSL_Types.LSLString(srdInfo.sdata) |
89 | }; | 111 | }; |
90 | m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( | 112 | sman.m_EventQueueManager.AddToScriptQueue( |
91 | srdInfo.m_localID, srdInfo.m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj | 113 | srdInfo.m_localID, srdInfo.m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj |
92 | ); | 114 | ); |
93 | } | ||
94 | 115 | ||
95 | srdInfo = xmlrpc.GetNextCompletedSRDRequest(); | 116 | handled = true; |
117 | } | ||
118 | } | ||
119 | |||
120 | if (! handled) | ||
121 | { | ||
122 | Console.WriteLine("Unhandled xml_srdrequest: " + srdInfo.GetReqID()); | ||
96 | } | 123 | } |
124 | |||
125 | srdInfo = xmlrpc.GetNextCompletedSRDRequest(); | ||
97 | } | 126 | } |
98 | } | 127 | } |
99 | } | 128 | } |