diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
4 files changed, 118 insertions, 50 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs index 7713490..60a1cb3 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs | |||
@@ -2091,6 +2091,10 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2091 | public const int REMOTE_DATA_CHANNEL = 1; | 2091 | public const int REMOTE_DATA_CHANNEL = 1; |
2092 | public const int REMOTE_DATA_REQUEST = 2; | 2092 | public const int REMOTE_DATA_REQUEST = 2; |
2093 | public const int REMOTE_DATA_REPLY = 3; | 2093 | public const int REMOTE_DATA_REPLY = 3; |
2094 | public const int HTTP_METHOD = 0; | ||
2095 | public const int HTTP_MIMETYPE = 1; | ||
2096 | public const int HTTP_BODY_MAXLENGTH = 2; | ||
2097 | public const int HTTP_VERIFY_CERT = 3; | ||
2094 | 2098 | ||
2095 | public const int PRIM_MATERIAL = 2; | 2099 | public const int PRIM_MATERIAL = 2; |
2096 | public const int PRIM_PHYSICS = 3; | 2100 | public const int PRIM_PHYSICS = 3; |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index c07f6d7..1ab2a43 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -2880,8 +2880,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2880 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) | 2880 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) |
2881 | { | 2881 | { |
2882 | m_host.AddScriptLPS(1); | 2882 | m_host.AddScriptLPS(1); |
2883 | NotImplemented("llSendRemoteData"); | 2883 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
2884 | return String.Empty; | 2884 | return (xmlrpcMod.SendRemoteData(m_localID, m_itemID, channel, dest, idata, sdata)).ToString(); |
2885 | } | 2885 | } |
2886 | 2886 | ||
2887 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) | 2887 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs index 1afe71c..0491612 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs | |||
@@ -125,8 +125,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
125 | comms.DeleteListener(itemID); | 125 | comms.DeleteListener(itemID); |
126 | 126 | ||
127 | IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 127 | IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
128 | xmlrpc.DeleteChannel(itemID); | 128 | xmlrpc.DeleteChannels(itemID); |
129 | 129 | ||
130 | xmlrpc.CancelSRDRequests(itemID); | ||
131 | |||
130 | } | 132 | } |
131 | 133 | ||
132 | #region TIMER | 134 | #region TIMER |
@@ -238,24 +240,29 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
238 | // implemented here yet anyway. Should be fixed if/when maxsize | 240 | // implemented here yet anyway. Should be fixed if/when maxsize |
239 | // is supported | 241 | // is supported |
240 | 242 | ||
241 | object[] resobj = new object[] | 243 | if (m_ScriptEngine.m_ScriptManager.GetScript(httpInfo.localID, httpInfo.itemID) != null) |
244 | { | ||
245 | iHttpReq.RemoveCompletedRequest(httpInfo.reqID); | ||
246 | object[] resobj = new object[] | ||
242 | { | 247 | { |
243 | httpInfo.reqID.ToString(), httpInfo.status, null, httpInfo.response_body | 248 | httpInfo.reqID.ToString(), httpInfo.status, null, httpInfo.response_body |
244 | }; | 249 | }; |
245 | 250 | ||
246 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( | 251 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( |
247 | httpInfo.localID, httpInfo.itemID, "http_response", EventQueueManager.llDetectNull, resobj | 252 | httpInfo.localID, httpInfo.itemID, "http_response", EventQueueManager.llDetectNull, resobj |
248 | ); | 253 | ); |
249 | 254 | ||
250 | httpInfo.Stop(); | 255 | } |
251 | httpInfo = null; | ||
252 | 256 | ||
253 | httpInfo = iHttpReq.GetNextCompletedRequest(); | 257 | httpInfo = iHttpReq.GetNextCompletedRequest(); |
258 | |||
254 | } | 259 | } |
255 | } | 260 | } |
256 | 261 | ||
257 | #endregion | 262 | #endregion |
258 | 263 | ||
264 | #region Check llRemoteData channels | ||
265 | |||
259 | public void CheckXMLRPCRequests() | 266 | public void CheckXMLRPCRequests() |
260 | { | 267 | { |
261 | if (m_ScriptEngine.World == null) | 268 | if (m_ScriptEngine.World == null) |
@@ -265,47 +272,96 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
265 | 272 | ||
266 | if (xmlrpc != null) | 273 | if (xmlrpc != null) |
267 | { | 274 | { |
268 | while (xmlrpc.hasRequests()) | 275 | RPCRequestInfo rInfo = xmlrpc.GetNextCompletedRequest(); |
276 | |||
277 | while (rInfo != null) | ||
269 | { | 278 | { |
270 | RPCRequestInfo rInfo = xmlrpc.GetNextRequest(); | 279 | if (m_ScriptEngine.m_ScriptManager.GetScript(rInfo.GetLocalID(), rInfo.GetItemID()) != null) |
271 | //Console.WriteLine("PICKED REQUEST"); | 280 | { |
281 | xmlrpc.RemoveCompletedRequest(rInfo.GetMessageID()); | ||
272 | 282 | ||
273 | //Deliver data to prim's remote_data handler | 283 | //Deliver data to prim's remote_data handler |
274 | object[] resobj = new object[] | 284 | object[] resobj = new object[] |
275 | { | 285 | { |
276 | 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), String.Empty, | 286 | 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), String.Empty, |
277 | rInfo.GetIntValue(), | 287 | rInfo.GetIntValue(), |
278 | rInfo.GetStrVal() | 288 | rInfo.GetStrVal() |
279 | }; | 289 | }; |
280 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( | 290 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( |
281 | rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", EventQueueManager.llDetectNull, resobj | 291 | rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", EventQueueManager.llDetectNull, resobj |
282 | ); | 292 | ); |
293 | |||
294 | } | ||
295 | |||
296 | rInfo = xmlrpc.GetNextCompletedRequest(); | ||
297 | |||
283 | } | 298 | } |
299 | |||
300 | SendRemoteDataRequest srdInfo = xmlrpc.GetNextCompletedSRDRequest(); | ||
301 | |||
302 | while (srdInfo != null) | ||
303 | { | ||
304 | if (m_ScriptEngine.m_ScriptManager.GetScript(srdInfo.m_localID, srdInfo.m_itemID) != null) | ||
305 | { | ||
306 | xmlrpc.RemoveCompletedSRDRequest(srdInfo.GetReqID()); | ||
307 | |||
308 | //Deliver data to prim's remote_data handler | ||
309 | object[] resobj = new object[] | ||
310 | { | ||
311 | 3, srdInfo.channel.ToString(), srdInfo.GetReqID().ToString(), String.Empty, | ||
312 | srdInfo.idata, | ||
313 | srdInfo.sdata | ||
314 | }; | ||
315 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( | ||
316 | srdInfo.m_localID, srdInfo.m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj | ||
317 | ); | ||
318 | |||
319 | } | ||
320 | |||
321 | srdInfo = xmlrpc.GetNextCompletedSRDRequest(); | ||
322 | |||
323 | } | ||
324 | |||
325 | |||
284 | } | 326 | } |
285 | } | 327 | } |
286 | 328 | ||
329 | #endregion | ||
330 | |||
331 | #region Check llListeners | ||
332 | |||
287 | public void CheckListeners() | 333 | public void CheckListeners() |
288 | { | 334 | { |
289 | if (m_ScriptEngine.World == null) | 335 | if (m_ScriptEngine.World == null) |
290 | return; | 336 | return; |
291 | IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 337 | IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
292 | 338 | ||
293 | while (comms.HasMessages()) | 339 | if (comms != null) |
294 | { | 340 | { |
295 | ListenerInfo lInfo = comms.GetNextMessage(); | 341 | while (comms.HasMessages()) |
296 | 342 | { | |
297 | //Deliver data to prim's listen handler | 343 | if (m_ScriptEngine.m_ScriptManager.GetScript( |
298 | object[] resobj = new object[] | 344 | comms.PeekNextMessageLocalID(), comms.PeekNextMessageItemID()) != null) |
299 | { | 345 | { |
300 | lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage() | 346 | ListenerInfo lInfo = comms.GetNextMessage(); |
301 | }; | ||
302 | 347 | ||
303 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( | 348 | //Deliver data to prim's listen handler |
304 | lInfo.GetLocalID(), lInfo.GetItemID(), "listen", EventQueueManager.llDetectNull, resobj | 349 | object[] resobj = new object[] |
305 | ); | 350 | { |
351 | lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage() | ||
352 | }; | ||
353 | |||
354 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( | ||
355 | lInfo.GetLocalID(), lInfo.GetItemID(), "listen", EventQueueManager.llDetectNull, resobj | ||
356 | ); | ||
357 | } | ||
358 | |||
359 | } | ||
306 | } | 360 | } |
307 | } | 361 | } |
308 | 362 | ||
363 | #endregion | ||
364 | |||
309 | /// <summary> | 365 | /// <summary> |
310 | /// If set to true then threads and stuff should try to make a graceful exit | 366 | /// If set to true then threads and stuff should try to make a graceful exit |
311 | /// </summary> | 367 | /// </summary> |
@@ -317,4 +373,4 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
317 | private bool _PleaseShutdown = false; | 373 | private bool _PleaseShutdown = false; |
318 | 374 | ||
319 | } | 375 | } |
320 | } \ No newline at end of file | 376 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index 641453e..d47cab8 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs | |||
@@ -67,6 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
67 | private Queue<LUStruct> LUQueue = new Queue<LUStruct>(); | 67 | private Queue<LUStruct> LUQueue = new Queue<LUStruct>(); |
68 | private static bool PrivateThread; | 68 | private static bool PrivateThread; |
69 | private int LoadUnloadMaxQueueSize; | 69 | private int LoadUnloadMaxQueueSize; |
70 | private Object scriptLock = new Object(); | ||
70 | 71 | ||
71 | // Load/Unload structure | 72 | // Load/Unload structure |
72 | private struct LUStruct | 73 | private struct LUStruct |
@@ -304,7 +305,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
304 | //ScriptBaseInterface Script = (ScriptBaseInterface)GetScript(localID, itemID); | 305 | //ScriptBaseInterface Script = (ScriptBaseInterface)GetScript(localID, itemID); |
305 | IScript Script = GetScript(localID, itemID); | 306 | IScript Script = GetScript(localID, itemID); |
306 | if (Script == null) | 307 | if (Script == null) |
308 | { | ||
307 | return; | 309 | return; |
310 | } | ||
308 | //cfk 2-7-08 dont need this right now and the default Linux build has DEBUG defined | 311 | //cfk 2-7-08 dont need this right now and the default Linux build has DEBUG defined |
309 | ///#if DEBUG | 312 | ///#if DEBUG |
310 | /// Console.WriteLine("ScriptEngine: Executing event: " + FunctionName); | 313 | /// Console.WriteLine("ScriptEngine: Executing event: " + FunctionName); |
@@ -331,37 +334,42 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
331 | 334 | ||
332 | public IScript GetScript(uint localID, LLUUID itemID) | 335 | public IScript GetScript(uint localID, LLUUID itemID) |
333 | { | 336 | { |
334 | if (Scripts.ContainsKey(localID) == false) | 337 | lock (scriptLock) |
335 | return null; | 338 | { |
336 | 339 | if (Scripts.ContainsKey(localID) == false) | |
337 | Dictionary<LLUUID, IScript> Obj; | 340 | return null; |
338 | Scripts.TryGetValue(localID, out Obj); | 341 | |
339 | if (Obj.ContainsKey(itemID) == false) | 342 | Dictionary<LLUUID, IScript> Obj; |
340 | return null; | 343 | Scripts.TryGetValue(localID, out Obj); |
341 | 344 | if (Obj.ContainsKey(itemID) == false) | |
342 | // Get script | 345 | return null; |
343 | IScript Script; | 346 | |
344 | Obj.TryGetValue(itemID, out Script); | 347 | // Get script |
345 | 348 | IScript Script; | |
346 | return Script; | 349 | Obj.TryGetValue(itemID, out Script); |
350 | return Script; | ||
351 | } | ||
347 | } | 352 | } |
348 | 353 | ||
349 | public void SetScript(uint localID, LLUUID itemID, IScript Script) | 354 | public void SetScript(uint localID, LLUUID itemID, IScript Script) |
350 | { | 355 | { |
351 | // Create object if it doesn't exist | 356 | lock (scriptLock) |
352 | if (Scripts.ContainsKey(localID) == false) | ||
353 | { | 357 | { |
354 | Scripts.Add(localID, new Dictionary<LLUUID, IScript>()); | 358 | // Create object if it doesn't exist |
355 | } | 359 | if (Scripts.ContainsKey(localID) == false) |
360 | { | ||
361 | Scripts.Add(localID, new Dictionary<LLUUID, IScript>()); | ||
362 | } | ||
356 | 363 | ||
357 | // Delete script if it exists | 364 | // Delete script if it exists |
358 | Dictionary<LLUUID, IScript> Obj; | 365 | Dictionary<LLUUID, IScript> Obj; |
359 | Scripts.TryGetValue(localID, out Obj); | 366 | Scripts.TryGetValue(localID, out Obj); |
360 | if (Obj.ContainsKey(itemID) == true) | 367 | if (Obj.ContainsKey(itemID) == true) |
361 | Obj.Remove(itemID); | 368 | Obj.Remove(itemID); |
362 | 369 | ||
363 | // Add to object | 370 | // Add to object |
364 | Obj.Add(itemID, Script); | 371 | Obj.Add(itemID, Script); |
372 | } | ||
365 | } | 373 | } |
366 | 374 | ||
367 | public void RemoveScript(uint localID, LLUUID itemID) | 375 | public void RemoveScript(uint localID, LLUUID itemID) |