aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-25 05:13:44 +0000
committerMelanie Thielker2008-09-25 05:13:44 +0000
commitf3c8963c86dbc969541ede80ae37eb59d26b7809 (patch)
treeff1e5cea74e9d5c2b73c476320a7bddf11d93766 /OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs
parentMantis#2123. Thank you kindly, Idb for a patch that solves: (diff)
downloadopensim-SC-f3c8963c86dbc969541ede80ae37eb59d26b7809.zip
opensim-SC-f3c8963c86dbc969541ede80ae37eb59d26b7809.tar.gz
opensim-SC-f3c8963c86dbc969541ede80ae37eb59d26b7809.tar.bz2
opensim-SC-f3c8963c86dbc969541ede80ae37eb59d26b7809.tar.xz
Convergence is almost complete. This brings the diff between the API to < 10k
and makes it use a common set of types in both engine. Fixes the issues with running both engines and HTTP requests / listens / timers etc.. Also fixes a couple of minor Scene issues and a CTB by nullref.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs130
1 files changed, 0 insertions, 130 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs
deleted file mode 100644
index 9a01cc4..0000000
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Modules.Scripting.XMLRPC;
31using OpenSim.Region.ScriptEngine.Shared;
32
33namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins
34{
35 public class XmlRequest
36 {
37 public AsyncCommandManager m_CmdManager;
38
39 public XmlRequest(AsyncCommandManager CmdManager)
40 {
41 m_CmdManager = CmdManager;
42 }
43
44 public void CheckXMLRPCRequests()
45 {
46 if (m_CmdManager.m_ScriptEngine.World == null)
47 return;
48
49 IXMLRPC xmlrpc = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
50 if (null == xmlrpc)
51 return;
52
53 // Process the completed request queue
54 RPCRequestInfo rInfo = xmlrpc.GetNextCompletedRequest();
55
56 while (rInfo != null)
57 {
58 bool handled = false;
59
60 // Request must be taken out of the queue in case there is no handler, otherwise we loop infinitely
61 xmlrpc.RemoveCompletedRequest(rInfo.GetMessageID());
62
63 // And since the xmlrpc request queue is actually shared among all regions on the simulator, we need
64 // to look in each one for the appropriate handler
65 foreach (ScriptEngine sman in ScriptEngine.ScriptEngines) {
66 if (sman.m_ScriptManager.GetScript(rInfo.GetLocalID(),rInfo.GetItemID()) != null) {
67
68 //Deliver data to prim's remote_data handler
69 object[] resobj = new object[]
70 {
71 new LSL_Types.LSLInteger(2), new LSL_Types.LSLString(rInfo.GetChannelKey().ToString()), new LSL_Types.LSLString(rInfo.GetMessageID().ToString()), new LSL_Types.LSLString(String.Empty),
72 new LSL_Types.LSLInteger(rInfo.GetIntValue()),
73 new LSL_Types.LSLString(rInfo.GetStrVal())
74 };
75 sman.m_EventQueueManager.AddToScriptQueue(
76 rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", EventQueueManager.llDetectNull, resobj
77 );
78
79 handled = true;
80 }
81 }
82
83 if (! handled)
84 {
85 Console.WriteLine("Unhandled xml_request: " + rInfo.GetItemID());
86 }
87
88 rInfo = xmlrpc.GetNextCompletedRequest();
89 }
90
91 // Process the send queue
92 SendRemoteDataRequest srdInfo = xmlrpc.GetNextCompletedSRDRequest();
93
94 while (srdInfo != null)
95 {
96 bool handled = false;
97
98 // Request must be taken out of the queue in case there is no handler, otherwise we loop infinitely
99 xmlrpc.RemoveCompletedSRDRequest(srdInfo.GetReqID());
100
101 // And this is another shared queue... so we check each of the script engines for a handler
102 foreach (ScriptEngine sman in ScriptEngine.ScriptEngines)
103 {
104 if (sman.m_ScriptManager.GetScript(srdInfo.m_localID,srdInfo.m_itemID) != null) {
105
106 //Deliver data to prim's remote_data handler
107 object[] resobj = new object[]
108 {
109 new LSL_Types.LSLInteger(3), new LSL_Types.LSLString(srdInfo.channel.ToString()), new LSL_Types.LSLString(srdInfo.GetReqID().ToString()), new LSL_Types.LSLString(String.Empty),
110 new LSL_Types.LSLInteger(srdInfo.idata),
111 new LSL_Types.LSLString(srdInfo.sdata)
112 };
113 sman.m_EventQueueManager.AddToScriptQueue(
114 srdInfo.m_localID, srdInfo.m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj
115 );
116
117 handled = true;
118 }
119 }
120
121 if (! handled)
122 {
123 Console.WriteLine("Unhandled xml_srdrequest: " + srdInfo.GetReqID());
124 }
125
126 srdInfo = xmlrpc.GetNextCompletedSRDRequest();
127 }
128 }
129 }
130}