aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs116
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs22
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs4
6 files changed, 74 insertions, 86 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index 020e64a..91ca298 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -54,47 +54,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
54 public IEventReceiver m_ScriptEngine; 54 public IEventReceiver m_ScriptEngine;
55 private IScene m_Scene; 55 private IScene m_Scene;
56 56
57 private static Dictionary<IScene, Dataserver> m_Dataserver = 57 private static Dictionary<IEventReceiver, Dataserver> m_Dataserver =
58 new Dictionary<IScene, Dataserver>(); 58 new Dictionary<IEventReceiver, Dataserver>();
59 private static Dictionary<IScene, Timer> m_Timer = 59 private static Dictionary<IEventReceiver, Timer> m_Timer =
60 new Dictionary<IScene, Timer>(); 60 new Dictionary<IEventReceiver, Timer>();
61 private static Dictionary<IScene, Listener> m_Listener = 61 private static Dictionary<IEventReceiver, Listener> m_Listener =
62 new Dictionary<IScene, Listener>(); 62 new Dictionary<IEventReceiver, Listener>();
63 private static Dictionary<IScene, HttpRequest> m_HttpRequest = 63 private static Dictionary<IEventReceiver, HttpRequest> m_HttpRequest =
64 new Dictionary<IScene, HttpRequest>(); 64 new Dictionary<IEventReceiver, HttpRequest>();
65 private static Dictionary<IScene, SensorRepeat> m_SensorRepeat = 65 private static Dictionary<IEventReceiver, SensorRepeat> m_SensorRepeat =
66 new Dictionary<IScene, SensorRepeat>(); 66 new Dictionary<IEventReceiver, SensorRepeat>();
67 private static Dictionary<IScene, XmlRequest> m_XmlRequest = 67 private static Dictionary<IEventReceiver, XmlRequest> m_XmlRequest =
68 new Dictionary<IScene, XmlRequest>(); 68 new Dictionary<IEventReceiver, XmlRequest>();
69 69
70 public Dataserver DataserverPlugin 70 public Dataserver DataserverPlugin
71 { 71 {
72 get { return m_Dataserver[m_Scene]; } 72 get { return m_Dataserver[m_ScriptEngine]; }
73 } 73 }
74 74
75 public Timer TimerPlugin 75 public Timer TimerPlugin
76 { 76 {
77 get { return m_Timer[m_Scene]; } 77 get { return m_Timer[m_ScriptEngine]; }
78 } 78 }
79 79
80 public HttpRequest HttpRequestPlugin 80 public HttpRequest HttpRequestPlugin
81 { 81 {
82 get { return m_HttpRequest[m_Scene]; } 82 get { return m_HttpRequest[m_ScriptEngine]; }
83 } 83 }
84 84
85 public Listener ListenerPlugin 85 public Listener ListenerPlugin
86 { 86 {
87 get { return m_Listener[m_Scene]; } 87 get { return m_Listener[m_ScriptEngine]; }
88 } 88 }
89 89
90 public SensorRepeat SensorRepeatPlugin 90 public SensorRepeat SensorRepeatPlugin
91 { 91 {
92 get { return m_SensorRepeat[m_Scene]; } 92 get { return m_SensorRepeat[m_ScriptEngine]; }
93 } 93 }
94 94
95 public XmlRequest XmlRequestPlugin 95 public XmlRequest XmlRequestPlugin
96 { 96 {
97 get { return m_XmlRequest[m_Scene]; } 97 get { return m_XmlRequest[m_ScriptEngine]; }
98 } 98 }
99 99
100 public IEventReceiver[] ScriptEngines 100 public IEventReceiver[] ScriptEngines
@@ -107,26 +107,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
107 m_ScriptEngine = _ScriptEngine; 107 m_ScriptEngine = _ScriptEngine;
108 m_Scene = m_ScriptEngine.World; 108 m_Scene = m_ScriptEngine.World;
109 109
110 if (m_Scenes.Count == 0)
111 ReadConfig();
112
110 if (!m_Scenes.Contains(m_Scene)) 113 if (!m_Scenes.Contains(m_Scene))
111 m_Scenes.Add(m_Scene); 114 m_Scenes.Add(m_Scene);
112 if (!m_ScriptEngines.Contains(m_ScriptEngine)) 115 if (!m_ScriptEngines.Contains(m_ScriptEngine))
113 m_ScriptEngines.Add(m_ScriptEngine); 116 m_ScriptEngines.Add(m_ScriptEngine);
114 117
115 ReadConfig();
116
117 // Create instances of all plugins 118 // Create instances of all plugins
118 if (!m_Dataserver.ContainsKey(m_Scene)) 119 if (!m_Dataserver.ContainsKey(m_ScriptEngine))
119 m_Dataserver[m_Scene] = new Dataserver(this); 120 m_Dataserver[m_ScriptEngine] = new Dataserver(this);
120 if (!m_Timer.ContainsKey(m_Scene)) 121 if (!m_Timer.ContainsKey(m_ScriptEngine))
121 m_Timer[m_Scene] = new Timer(this); 122 m_Timer[m_ScriptEngine] = new Timer(this);
122 if (!m_HttpRequest.ContainsKey(m_Scene)) 123 if (!m_HttpRequest.ContainsKey(m_ScriptEngine))
123 m_HttpRequest[m_Scene] = new HttpRequest(this); 124 m_HttpRequest[m_ScriptEngine] = new HttpRequest(this);
124 if (!m_Listener.ContainsKey(m_Scene)) 125 if (!m_Listener.ContainsKey(m_ScriptEngine))
125 m_Listener[m_Scene] = new Listener(this); 126 m_Listener[m_ScriptEngine] = new Listener(this);
126 if (!m_SensorRepeat.ContainsKey(m_Scene)) 127 if (!m_SensorRepeat.ContainsKey(m_ScriptEngine))
127 m_SensorRepeat[m_Scene] = new SensorRepeat(this); 128 m_SensorRepeat[m_ScriptEngine] = new SensorRepeat(this);
128 if (!m_XmlRequest.ContainsKey(m_Scene)) 129 if (!m_XmlRequest.ContainsKey(m_ScriptEngine))
129 m_XmlRequest[m_Scene] = new XmlRequest(this); 130 m_XmlRequest[m_ScriptEngine] = new XmlRequest(this);
130 131
131 StartThread(); 132 StartThread();
132 } 133 }
@@ -145,7 +146,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
145 } 146 }
146 } 147 }
147 148
148 public void ReadConfig() 149 private void ReadConfig()
149 { 150 {
150// cmdHandlerThreadCycleSleepms = m_ScriptEngine.Config.GetInt("AsyncLLCommandLoopms", 100); 151// cmdHandlerThreadCycleSleepms = m_ScriptEngine.Config.GetInt("AsyncLLCommandLoopms", 100);
151 // TODO: Make this sane again 152 // TODO: Make this sane again
@@ -195,18 +196,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
195 196
196 private static void DoOneCmdHandlerPass() 197 private static void DoOneCmdHandlerPass()
197 { 198 {
198 foreach (IScene s in m_Scenes) 199 // Check Listeners
200 m_Listener[m_ScriptEngines[0]].CheckListeners();
201
202 // Check HttpRequests
203 m_HttpRequest[m_ScriptEngines[0]].CheckHttpRequests();
204
205 // Check XMLRPCRequests
206 m_XmlRequest[m_ScriptEngines[0]].CheckXMLRPCRequests();
207
208 foreach (IEventReceiver s in m_ScriptEngines)
199 { 209 {
200 // Check timers 210 // Check timers
201 m_Timer[s].CheckTimerEvents(); 211 m_Timer[s].CheckTimerEvents();
202 // Check HttpRequests 212
203 m_HttpRequest[s].CheckHttpRequests();
204 // Check XMLRPCRequests
205 m_XmlRequest[s].CheckXMLRPCRequests();
206 // Check Listeners
207 m_Listener[s].CheckListeners();
208 // Check Sensors 213 // Check Sensors
209 m_SensorRepeat[s].CheckSenseRepeaterEvents(); 214 m_SensorRepeat[s].CheckSenseRepeaterEvents();
215
210 // Check dataserver 216 // Check dataserver
211 m_Dataserver[s].ExpireRequests(); 217 m_Dataserver[s].ExpireRequests();
212 } 218 }
@@ -217,38 +223,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
217 /// </summary> 223 /// </summary>
218 /// <param name="localID"></param> 224 /// <param name="localID"></param>
219 /// <param name="itemID"></param> 225 /// <param name="itemID"></param>
220 public static void RemoveScript(IScene scene, uint localID, UUID itemID) 226 public static void RemoveScript(IEventReceiver engine, uint localID, UUID itemID)
221 { 227 {
222 // Remove a specific script 228 // Remove a specific script
223 229
224 // Remove dataserver events 230 // Remove dataserver events
225 m_Dataserver[scene].RemoveEvents(localID, itemID); 231 m_Dataserver[engine].RemoveEvents(localID, itemID);
226 232
227 // Remove from: Timers 233 // Remove from: Timers
228 m_Timer[scene].UnSetTimerEvents(localID, itemID); 234 m_Timer[engine].UnSetTimerEvents(localID, itemID);
229 235
230 // Remove from: HttpRequest 236 // Remove from: HttpRequest
231 IHttpRequests iHttpReq = 237 IHttpRequests iHttpReq =
232 scene.RequestModuleInterface<IHttpRequests>(); 238 engine.World.RequestModuleInterface<IHttpRequests>();
233 iHttpReq.StopHttpRequest(localID, itemID); 239 iHttpReq.StopHttpRequest(localID, itemID);
234 240
235 IWorldComm comms = scene.RequestModuleInterface<IWorldComm>(); 241 IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>();
236 comms.DeleteListener(itemID); 242 comms.DeleteListener(itemID);
237 243
238 IXMLRPC xmlrpc = scene.RequestModuleInterface<IXMLRPC>(); 244 IXMLRPC xmlrpc = engine.World.RequestModuleInterface<IXMLRPC>();
239 xmlrpc.DeleteChannels(itemID); 245 xmlrpc.DeleteChannels(itemID);
240 xmlrpc.CancelSRDRequests(itemID); 246 xmlrpc.CancelSRDRequests(itemID);
241 247
242 // Remove Sensors 248 // Remove Sensors
243 m_SensorRepeat[scene].UnSetSenseRepeaterEvents(localID, itemID); 249 m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
244 250
245 } 251 }
246 252
247 public static Object[] GetSerializationData(IScene scene, UUID itemID) 253 public static Object[] GetSerializationData(IEventReceiver engine, UUID itemID)
248 { 254 {
249 List<Object> data = new List<Object>(); 255 List<Object> data = new List<Object>();
250 256
251 Object[] listeners=m_Listener[scene].GetSerializationData(itemID); 257 Object[] listeners=m_Listener[engine].GetSerializationData(itemID);
252 if (listeners.Length > 0) 258 if (listeners.Length > 0)
253 { 259 {
254 data.Add("listener"); 260 data.Add("listener");
@@ -256,7 +262,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
256 data.AddRange(listeners); 262 data.AddRange(listeners);
257 } 263 }
258 264
259 Object[] timers=m_Timer[scene].GetSerializationData(itemID); 265 Object[] timers=m_Timer[engine].GetSerializationData(itemID);
260 if (timers.Length > 0) 266 if (timers.Length > 0)
261 { 267 {
262 data.Add("timer"); 268 data.Add("timer");
@@ -264,7 +270,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
264 data.AddRange(timers); 270 data.AddRange(timers);
265 } 271 }
266 272
267 Object[] sensors=m_SensorRepeat[scene].GetSerializationData(itemID); 273 Object[] sensors=m_SensorRepeat[engine].GetSerializationData(itemID);
268 if (sensors.Length > 0) 274 if (sensors.Length > 0)
269 { 275 {
270 data.Add("sensor"); 276 data.Add("sensor");
@@ -275,7 +281,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
275 return data.ToArray(); 281 return data.ToArray();
276 } 282 }
277 283
278 public static void CreateFromData(IScene scene, uint localID, 284 public static void CreateFromData(IEventReceiver engine, uint localID,
279 UUID itemID, UUID hostID, Object[] data) 285 UUID itemID, UUID hostID, Object[] data)
280 { 286 {
281 int idx = 0; 287 int idx = 0;
@@ -297,15 +303,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
297 switch (type) 303 switch (type)
298 { 304 {
299 case "listener": 305 case "listener":
300 m_Listener[scene].CreateFromData(localID, itemID, 306 m_Listener[engine].CreateFromData(localID, itemID,
301 hostID, item); 307 hostID, item);
302 break; 308 break;
303 case "timer": 309 case "timer":
304 m_Timer[scene].CreateFromData(localID, itemID, 310 m_Timer[engine].CreateFromData(localID, itemID,
305 hostID, item); 311 hostID, item);
306 break; 312 break;
307 case "sensor": 313 case "sensor":
308 m_SensorRepeat[scene].CreateFromData(localID, 314 m_SensorRepeat[engine].CreateFromData(localID,
309 itemID, hostID, item); 315 itemID, hostID, item);
310 break; 316 break;
311 } 317 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs
index 3d3fb05..0c77a9d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
58 58
59 while (httpInfo != null) 59 while (httpInfo != null)
60 { 60 {
61 //m_ScriptEngine.Log.Info("[AsyncLSL]:" + httpInfo.response_body + httpInfo.status); 61 //System.Console.WriteLine("[AsyncLSL]:" + httpInfo.response_body + httpInfo.status);
62 62
63 // Deliver data to prim's remote_data handler 63 // Deliver data to prim's remote_data handler
64 // 64 //
@@ -77,7 +77,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
77 new LSL_Types.LSLString(httpInfo.response_body) 77 new LSL_Types.LSLString(httpInfo.response_body)
78 }; 78 };
79 79
80 foreach (IScriptEngine e in m_CmdManager.ScriptEngines) 80 foreach (IEventReceiver e in m_CmdManager.ScriptEngines)
81 { 81 {
82 if (e.PostObjectEvent(httpInfo.localID, 82 if (e.PostObjectEvent(httpInfo.localID,
83 new EventParams("http_response", 83 new EventParams("http_response",
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
index b353cba..59d5060 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
@@ -29,6 +29,7 @@ using System;
29using OpenMetaverse; 29using OpenMetaverse;
30using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Modules.Scripting.WorldComm; 31using OpenSim.Region.Environment.Modules.Scripting.WorldComm;
32using OpenSim.Region.ScriptEngine.Interfaces;
32using OpenSim.Region.ScriptEngine.Shared; 33using OpenSim.Region.ScriptEngine.Shared;
33using OpenSim.Region.ScriptEngine.Shared.Api; 34using OpenSim.Region.ScriptEngine.Shared.Api;
34 35
@@ -66,10 +67,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
66 new LSL_Types.LSLString(lInfo.GetMessage()) 67 new LSL_Types.LSLString(lInfo.GetMessage())
67 }; 68 };
68 69
69 m_CmdManager.m_ScriptEngine.PostScriptEvent( 70 foreach (IEventReceiver e in m_CmdManager.ScriptEngines)
70 lInfo.GetItemID(), new EventParams( 71 {
71 "listen", resobj, 72 e.PostScriptEvent(
72 new DetectParams[0])); 73 lInfo.GetItemID(), new EventParams(
74 "listen", resobj,
75 new DetectParams[0]));
76 }
73 } 77 }
74 } 78 }
75 } 79 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index d1e3921..9b0bc5b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -156,28 +156,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
156 SensorSweep(ts); 156 SensorSweep(ts);
157 } 157 }
158 158
159 public LSL_Types.list GetSensorList(uint m_localID, UUID m_itemID)
160 {
161 lock (SenseLock)
162 {
163 Dictionary<UUID, LSL_Types.list> Obj = null;
164 if (!SenseEvents.TryGetValue(m_localID, out Obj))
165 {
166 return null;
167 }
168 lock (Obj)
169 {
170 // Get script
171 LSL_Types.list SenseList = null;
172 if (!Obj.TryGetValue(m_itemID, out SenseList))
173 {
174 return null;
175 }
176 return SenseList;
177 }
178 }
179 }
180
181 private void SensorSweep(SenseRepeatClass ts) 159 private void SensorSweep(SenseRepeatClass ts)
182 { 160 {
183 SceneObjectPart SensePoint = ts.host; 161 SceneObjectPart SensePoint = ts.host;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
index ec7cd35..91cef9b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
@@ -108,7 +108,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
108 // Time has passed? 108 // Time has passed?
109 if (ts.next < DateTime.Now.Ticks) 109 if (ts.next < DateTime.Now.Ticks)
110 { 110 {
111 // Console.WriteLine("Time has passed: Now: " + DateTime.Now.Ticks + ", Passed: " + ts.next); 111 //Console.WriteLine("Time has passed: Now: " + DateTime.Now.Ticks + ", Passed: " + ts.next);
112 // Add it to queue 112 // Add it to queue
113 m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID, 113 m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID,
114 new EventParams("timer", new Object[0], 114 new EventParams("timer", new Object[0],
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs
index a7699a1..1c1ea0b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
71 new LSL_Types.LSLString(rInfo.GetStrVal()) 71 new LSL_Types.LSLString(rInfo.GetStrVal())
72 }; 72 };
73 73
74 foreach (IScriptEngine e in m_CmdManager.ScriptEngines) 74 foreach (IEventReceiver e in m_CmdManager.ScriptEngines)
75 { 75 {
76 if (e.PostScriptEvent( 76 if (e.PostScriptEvent(
77 rInfo.GetItemID(), new EventParams( 77 rInfo.GetItemID(), new EventParams(
@@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
100 new LSL_Types.LSLString(srdInfo.sdata) 100 new LSL_Types.LSLString(srdInfo.sdata)
101 }; 101 };
102 102
103 foreach (IScriptEngine e in m_CmdManager.ScriptEngines) 103 foreach (IEventReceiver e in m_CmdManager.ScriptEngines)
104 { 104 {
105 if (e.PostScriptEvent( 105 if (e.PostScriptEvent(
106 srdInfo.m_itemID, new EventParams( 106 srdInfo.m_itemID, new EventParams(