diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps')
10 files changed, 306 insertions, 177 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs new file mode 100644 index 0000000..10a4753 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs | |||
@@ -0,0 +1,139 @@ | |||
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 OpenSimulator 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 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Specialized; | ||
31 | using System.Drawing; | ||
32 | using System.Drawing.Imaging; | ||
33 | using System.Reflection; | ||
34 | using System.IO; | ||
35 | using System.Web; | ||
36 | using log4net; | ||
37 | using Nini.Config; | ||
38 | using Mono.Addins; | ||
39 | using OpenMetaverse; | ||
40 | using OpenMetaverse.StructuredData; | ||
41 | using OpenSim.Framework; | ||
42 | using OpenSim.Framework.Servers; | ||
43 | using OpenSim.Framework.Servers.HttpServer; | ||
44 | using OpenSim.Region.Framework.Interfaces; | ||
45 | using OpenSim.Region.Framework.Scenes; | ||
46 | using OpenSim.Services.Interfaces; | ||
47 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
48 | using OpenSim.Capabilities.Handlers; | ||
49 | |||
50 | namespace OpenSim.Region.ClientStack.Linden | ||
51 | { | ||
52 | |||
53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AvatarPickerSearchModule")] | ||
54 | public class AvatarPickerSearchModule : INonSharedRegionModule | ||
55 | { | ||
56 | private static readonly ILog m_log = | ||
57 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
58 | |||
59 | private Scene m_scene; | ||
60 | private IPeople m_People; | ||
61 | private bool m_Enabled = false; | ||
62 | |||
63 | private string m_URL; | ||
64 | |||
65 | #region ISharedRegionModule Members | ||
66 | |||
67 | public void Initialise(IConfigSource source) | ||
68 | { | ||
69 | IConfig config = source.Configs["ClientStack.LindenCaps"]; | ||
70 | if (config == null) | ||
71 | return; | ||
72 | |||
73 | m_URL = config.GetString("Cap_AvatarPickerSearch", string.Empty); | ||
74 | // Cap doesn't exist | ||
75 | if (m_URL != string.Empty) | ||
76 | m_Enabled = true; | ||
77 | } | ||
78 | |||
79 | public void AddRegion(Scene s) | ||
80 | { | ||
81 | if (!m_Enabled) | ||
82 | return; | ||
83 | |||
84 | m_scene = s; | ||
85 | } | ||
86 | |||
87 | public void RemoveRegion(Scene s) | ||
88 | { | ||
89 | if (!m_Enabled) | ||
90 | return; | ||
91 | |||
92 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | ||
93 | m_scene = null; | ||
94 | } | ||
95 | |||
96 | public void RegionLoaded(Scene s) | ||
97 | { | ||
98 | if (!m_Enabled) | ||
99 | return; | ||
100 | |||
101 | m_People = m_scene.RequestModuleInterface<IPeople>(); | ||
102 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
103 | } | ||
104 | |||
105 | public void PostInitialise() | ||
106 | { | ||
107 | } | ||
108 | |||
109 | public void Close() { } | ||
110 | |||
111 | public string Name { get { return "AvatarPickerSearchModule"; } } | ||
112 | |||
113 | public Type ReplaceableInterface | ||
114 | { | ||
115 | get { return null; } | ||
116 | } | ||
117 | |||
118 | #endregion | ||
119 | |||
120 | public void RegisterCaps(UUID agentID, Caps caps) | ||
121 | { | ||
122 | UUID capID = UUID.Random(); | ||
123 | |||
124 | if (m_URL == "localhost") | ||
125 | { | ||
126 | // m_log.DebugFormat("[AVATAR PICKER SEARCH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | ||
127 | caps.RegisterHandler( | ||
128 | "AvatarPickerSearch", | ||
129 | new AvatarPickerSearchHandler("/CAPS/" + capID + "/", m_People, "AvatarPickerSearch", "Search for avatars by name")); | ||
130 | } | ||
131 | else | ||
132 | { | ||
133 | // m_log.DebugFormat("[AVATAR PICKER SEARCH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); | ||
134 | caps.RegisterHandler("AvatarPickerSearch", m_URL); | ||
135 | } | ||
136 | } | ||
137 | |||
138 | } | ||
139 | } | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 8241e07..762e22a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -282,13 +282,19 @@ namespace OpenSim.Region.ClientStack.Linden | |||
282 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); | 282 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); |
283 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); | 283 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); |
284 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); | 284 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); |
285 | IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData); | 285 | |
286 | IRequestHandler getObjectPhysicsDataHandler | ||
287 | = new RestStreamHandler( | ||
288 | "POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null); | ||
286 | m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); | 289 | m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); |
287 | IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); | 290 | IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); |
288 | m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); | 291 | m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); |
289 | IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); | 292 | IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); |
290 | m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); | 293 | m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); |
291 | IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler("POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation); | 294 | |
295 | IRequestHandler UpdateAgentInformationHandler | ||
296 | = new RestStreamHandler( | ||
297 | "POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation, "UpdateAgentInformation", null); | ||
292 | m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler); | 298 | m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler); |
293 | 299 | ||
294 | m_HostCapsObj.RegisterHandler( | 300 | m_HostCapsObj.RegisterHandler( |
@@ -361,18 +367,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
361 | foreach (OSD c in capsRequested) | 367 | foreach (OSD c in capsRequested) |
362 | validCaps.Add(c.AsString()); | 368 | validCaps.Add(c.AsString()); |
363 | 369 | ||
364 | Hashtable caps = m_HostCapsObj.CapsHandlers.GetCapsDetails(true, validCaps); | 370 | string result = LLSDHelpers.SerialiseLLSDReply(m_HostCapsObj.GetCapsDetails(true, validCaps)); |
365 | |||
366 | // Add the external too | ||
367 | foreach (KeyValuePair<string, string> kvp in m_HostCapsObj.ExternalCapsHandlers) | ||
368 | { | ||
369 | if (!validCaps.Contains(kvp.Key)) | ||
370 | continue; | ||
371 | |||
372 | caps[kvp.Key] = kvp.Value; | ||
373 | } | ||
374 | |||
375 | string result = LLSDHelpers.SerialiseLLSDReply(caps); | ||
376 | 371 | ||
377 | //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); | 372 | //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); |
378 | 373 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index eb40eb1..725bf06 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | |||
@@ -65,6 +65,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
65 | /// </value> | 65 | /// </value> |
66 | public int DebugLevel { get; set; } | 66 | public int DebugLevel { get; set; } |
67 | 67 | ||
68 | // Viewer post requests timeout in 60 secs | ||
69 | // https://bitbucket.org/lindenlab/viewer-release/src/421c20423df93d650cc305dc115922bb30040999/indra/llmessage/llhttpclient.cpp?at=default#cl-44 | ||
70 | // | ||
71 | private const int VIEWER_TIMEOUT = 60 * 1000; | ||
72 | // Just to be safe, we work on a 10 sec shorter cycle | ||
73 | private const int SERVER_EQ_TIME_NO_EVENTS = VIEWER_TIMEOUT - (10 * 1000); | ||
74 | |||
68 | protected Scene m_scene; | 75 | protected Scene m_scene; |
69 | 76 | ||
70 | private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>(); | 77 | private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>(); |
@@ -84,7 +91,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
84 | scene.RegisterModuleInterface<IEventQueue>(this); | 91 | scene.RegisterModuleInterface<IEventQueue>(this); |
85 | 92 | ||
86 | scene.EventManager.OnClientClosed += ClientClosed; | 93 | scene.EventManager.OnClientClosed += ClientClosed; |
87 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; | ||
88 | scene.EventManager.OnRegisterCaps += OnRegisterCaps; | 94 | scene.EventManager.OnRegisterCaps += OnRegisterCaps; |
89 | 95 | ||
90 | MainConsole.Instance.Commands.AddCommand( | 96 | MainConsole.Instance.Commands.AddCommand( |
@@ -113,7 +119,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
113 | return; | 119 | return; |
114 | 120 | ||
115 | scene.EventManager.OnClientClosed -= ClientClosed; | 121 | scene.EventManager.OnClientClosed -= ClientClosed; |
116 | scene.EventManager.OnMakeChildAgent -= MakeChildAgent; | ||
117 | scene.EventManager.OnRegisterCaps -= OnRegisterCaps; | 122 | scene.EventManager.OnRegisterCaps -= OnRegisterCaps; |
118 | 123 | ||
119 | scene.UnregisterModuleInterface<IEventQueue>(this); | 124 | scene.UnregisterModuleInterface<IEventQueue>(this); |
@@ -182,14 +187,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
182 | { | 187 | { |
183 | if (!queues.ContainsKey(agentId)) | 188 | if (!queues.ContainsKey(agentId)) |
184 | { | 189 | { |
185 | /* | ||
186 | m_log.DebugFormat( | 190 | m_log.DebugFormat( |
187 | "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", | 191 | "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", |
188 | agentId, m_scene.RegionInfo.RegionName); | 192 | agentId, m_scene.RegionInfo.RegionName); |
189 | */ | ||
190 | queues[agentId] = new Queue<OSD>(); | 193 | queues[agentId] = new Queue<OSD>(); |
191 | } | 194 | } |
192 | 195 | ||
193 | return queues[agentId]; | 196 | return queues[agentId]; |
194 | } | 197 | } |
195 | } | 198 | } |
@@ -221,8 +224,17 @@ namespace OpenSim.Region.ClientStack.Linden | |||
221 | { | 224 | { |
222 | Queue<OSD> queue = GetQueue(avatarID); | 225 | Queue<OSD> queue = GetQueue(avatarID); |
223 | if (queue != null) | 226 | if (queue != null) |
227 | { | ||
224 | lock (queue) | 228 | lock (queue) |
225 | queue.Enqueue(ev); | 229 | queue.Enqueue(ev); |
230 | } | ||
231 | else | ||
232 | { | ||
233 | OSDMap evMap = (OSDMap)ev; | ||
234 | m_log.WarnFormat( | ||
235 | "[EVENTQUEUE]: (Enqueue) No queue found for agent {0} when placing message {1} in region {2}", | ||
236 | avatarID, evMap["message"], m_scene.Name); | ||
237 | } | ||
226 | } | 238 | } |
227 | catch (NullReferenceException e) | 239 | catch (NullReferenceException e) |
228 | { | 240 | { |
@@ -237,44 +249,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
237 | 249 | ||
238 | private void ClientClosed(UUID agentID, Scene scene) | 250 | private void ClientClosed(UUID agentID, Scene scene) |
239 | { | 251 | { |
240 | // m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); | 252 | //m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); |
241 | |||
242 | int count = 0; | ||
243 | while (queues.ContainsKey(agentID) && queues[agentID].Count > 0 && count++ < 5) | ||
244 | { | ||
245 | Thread.Sleep(1000); | ||
246 | } | ||
247 | 253 | ||
248 | lock (queues) | 254 | lock (queues) |
249 | { | ||
250 | queues.Remove(agentID); | 255 | queues.Remove(agentID); |
251 | } | ||
252 | 256 | ||
253 | List<UUID> removeitems = new List<UUID>(); | 257 | List<UUID> removeitems = new List<UUID>(); |
254 | lock (m_AvatarQueueUUIDMapping) | 258 | lock (m_AvatarQueueUUIDMapping) |
255 | { | 259 | m_AvatarQueueUUIDMapping.Remove(agentID); |
256 | foreach (UUID ky in m_AvatarQueueUUIDMapping.Keys) | ||
257 | { | ||
258 | // m_log.DebugFormat("[EVENTQUEUE]: Found key {0} in m_AvatarQueueUUIDMapping while looking for {1}", ky, AgentID); | ||
259 | if (ky == agentID) | ||
260 | { | ||
261 | removeitems.Add(ky); | ||
262 | } | ||
263 | } | ||
264 | |||
265 | foreach (UUID ky in removeitems) | ||
266 | { | ||
267 | UUID eventQueueGetUuid = m_AvatarQueueUUIDMapping[ky]; | ||
268 | m_AvatarQueueUUIDMapping.Remove(ky); | ||
269 | |||
270 | string eqgPath = GenerateEqgCapPath(eventQueueGetUuid); | ||
271 | MainServer.Instance.RemovePollServiceHTTPHandler("", eqgPath); | ||
272 | |||
273 | // m_log.DebugFormat( | ||
274 | // "[EVENT QUEUE GET MODULE]: Removed EQG handler {0} for {1} in {2}", | ||
275 | // eqgPath, agentID, m_scene.RegionInfo.RegionName); | ||
276 | } | ||
277 | } | ||
278 | 260 | ||
279 | UUID searchval = UUID.Zero; | 261 | UUID searchval = UUID.Zero; |
280 | 262 | ||
@@ -295,19 +277,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
295 | foreach (UUID ky in removeitems) | 277 | foreach (UUID ky in removeitems) |
296 | m_QueueUUIDAvatarMapping.Remove(ky); | 278 | m_QueueUUIDAvatarMapping.Remove(ky); |
297 | } | 279 | } |
298 | } | ||
299 | 280 | ||
300 | private void MakeChildAgent(ScenePresence avatar) | 281 | // m_log.DebugFormat("[EVENTQUEUE]: Deleted queues for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); |
301 | { | 282 | |
302 | //m_log.DebugFormat("[EVENTQUEUE]: Make Child agent {0} in region {1}.", avatar.UUID, m_scene.RegionInfo.RegionName); | ||
303 | //lock (m_ids) | ||
304 | // { | ||
305 | //if (m_ids.ContainsKey(avatar.UUID)) | ||
306 | //{ | ||
307 | // close the event queue. | ||
308 | //m_ids[avatar.UUID] = -1; | ||
309 | //} | ||
310 | //} | ||
311 | } | 283 | } |
312 | 284 | ||
313 | /// <summary> | 285 | /// <summary> |
@@ -359,28 +331,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
359 | m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID); | 331 | m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID); |
360 | } | 332 | } |
361 | 333 | ||
362 | string eventQueueGetPath = GenerateEqgCapPath(eventQueueGetUUID); | 334 | caps.RegisterPollHandler( |
363 | 335 | "EventQueueGet", | |
364 | // Register this as a caps handler | 336 | new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, agentID, SERVER_EQ_TIME_NO_EVENTS)); |
365 | // FIXME: Confusingly, we need to register separate as a capability so that the client is told about | ||
366 | // EventQueueGet when it receive capability information, but then we replace the rest handler immediately | ||
367 | // afterwards with the poll service. So for now, we'll pass a null instead to simplify code reading, but | ||
368 | // really it should be possible to directly register the poll handler as a capability. | ||
369 | caps.RegisterHandler("EventQueueGet", new RestHTTPHandler("POST", eventQueueGetPath, null)); | ||
370 | // delegate(Hashtable m_dhttpMethod) | ||
371 | // { | ||
372 | // return ProcessQueue(m_dhttpMethod, agentID, caps); | ||
373 | // })); | ||
374 | |||
375 | // This will persist this beyond the expiry of the caps handlers | ||
376 | // TODO: Add EventQueueGet name/description for diagnostics | ||
377 | MainServer.Instance.AddPollServiceHTTPHandler( | ||
378 | eventQueueGetPath, | ||
379 | new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID, 40000)); | ||
380 | |||
381 | // m_log.DebugFormat( | ||
382 | // "[EVENT QUEUE GET MODULE]: Registered EQG handler {0} for {1} in {2}", | ||
383 | // eventQueueGetPath, agentID, m_scene.RegionInfo.RegionName); | ||
384 | 337 | ||
385 | Random rnd = new Random(Environment.TickCount); | 338 | Random rnd = new Random(Environment.TickCount); |
386 | lock (m_ids) | 339 | lock (m_ids) |
@@ -398,7 +351,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
398 | Queue<OSD> queue = GetQueue(agentID); | 351 | Queue<OSD> queue = GetQueue(agentID); |
399 | if (queue != null) | 352 | if (queue != null) |
400 | lock (queue) | 353 | lock (queue) |
354 | { | ||
355 | //m_log.WarnFormat("POLLED FOR EVENTS BY {0} in {1} -- {2}", agentID, m_scene.RegionInfo.RegionName, queue.Count); | ||
401 | return queue.Count > 0; | 356 | return queue.Count > 0; |
357 | } | ||
402 | 358 | ||
403 | return false; | 359 | return false; |
404 | } | 360 | } |
@@ -414,16 +370,21 @@ namespace OpenSim.Region.ClientStack.Linden | |||
414 | OSDMap ev = (OSDMap)element; | 370 | OSDMap ev = (OSDMap)element; |
415 | m_log.DebugFormat( | 371 | m_log.DebugFormat( |
416 | "Eq OUT {0,-30} to {1,-20} {2,-20}", | 372 | "Eq OUT {0,-30} to {1,-20} {2,-20}", |
417 | ev["message"], m_scene.GetScenePresence(agentId).Name, m_scene.RegionInfo.RegionName); | 373 | ev["message"], m_scene.GetScenePresence(agentId).Name, m_scene.Name); |
418 | } | 374 | } |
419 | } | 375 | } |
420 | 376 | ||
421 | public Hashtable GetEvents(UUID requestID, UUID pAgentId) | 377 | public Hashtable GetEvents(UUID requestID, UUID pAgentId) |
422 | { | 378 | { |
423 | if (DebugLevel >= 2) | 379 | if (DebugLevel >= 2) |
424 | m_log.DebugFormat("POLLED FOR EQ MESSAGES BY {0} in {1}", pAgentId, m_scene.RegionInfo.RegionName); | 380 | m_log.WarnFormat("POLLED FOR EQ MESSAGES BY {0} in {1}", pAgentId, m_scene.Name); |
381 | |||
382 | Queue<OSD> queue = GetQueue(pAgentId); | ||
383 | if (queue == null) | ||
384 | { | ||
385 | return NoEvents(requestID, pAgentId); | ||
386 | } | ||
425 | 387 | ||
426 | Queue<OSD> queue = TryGetQueue(pAgentId); | ||
427 | OSD element; | 388 | OSD element; |
428 | lock (queue) | 389 | lock (queue) |
429 | { | 390 | { |
@@ -794,12 +755,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
794 | 755 | ||
795 | } | 756 | } |
796 | 757 | ||
797 | public void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat, | 758 | public void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID anotherAgent, bool canVoiceChat, |
798 | bool isModerator, bool textMute) | 759 | bool isModerator, bool textMute) |
799 | { | 760 | { |
800 | OSD item = EventQueueHelper.ChatterBoxSessionAgentListUpdates(sessionID, fromAgent, canVoiceChat, | 761 | OSD item = EventQueueHelper.ChatterBoxSessionAgentListUpdates(sessionID, fromAgent, canVoiceChat, |
801 | isModerator, textMute); | 762 | isModerator, textMute); |
802 | Enqueue(item, toAgent); | 763 | Enqueue(item, fromAgent); |
803 | //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item); | 764 | //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item); |
804 | } | 765 | } |
805 | 766 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs index 141af8a..b3b0b8a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs | |||
@@ -76,7 +76,7 @@ namespace OpenSim.Region.ClientStack.Linden.Tests | |||
76 | } | 76 | } |
77 | 77 | ||
78 | [Test] | 78 | [Test] |
79 | public void AddForClient() | 79 | public void TestAddForClient() |
80 | { | 80 | { |
81 | TestHelpers.InMethod(); | 81 | TestHelpers.InMethod(); |
82 | // log4net.Config.XmlConfigurator.Configure(); | 82 | // log4net.Config.XmlConfigurator.Configure(); |
@@ -88,10 +88,10 @@ namespace OpenSim.Region.ClientStack.Linden.Tests | |||
88 | } | 88 | } |
89 | 89 | ||
90 | [Test] | 90 | [Test] |
91 | public void RemoveForClient() | 91 | public void TestRemoveForClient() |
92 | { | 92 | { |
93 | TestHelpers.InMethod(); | 93 | TestHelpers.InMethod(); |
94 | // log4net.Config.XmlConfigurator.Configure(); | 94 | // TestHelpers.EnableLogging(); |
95 | 95 | ||
96 | UUID spId = TestHelpers.ParseTail(0x1); | 96 | UUID spId = TestHelpers.ParseTail(0x1); |
97 | 97 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 6ec1115..7b15284 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | |||
@@ -246,8 +246,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
246 | 246 | ||
247 | private Scene m_scene; | 247 | private Scene m_scene; |
248 | private MeshCapsDataThrottler m_throttler; | 248 | private MeshCapsDataThrottler m_throttler; |
249 | public PollServiceMeshEventArgs(UUID pId, Scene scene) : | 249 | public PollServiceMeshEventArgs(string uri, UUID pId, Scene scene) : |
250 | base(null, null, null, null, pId, int.MaxValue) | 250 | base(null, uri, null, null, null, pId, int.MaxValue) |
251 | { | 251 | { |
252 | m_scene = scene; | 252 | m_scene = scene; |
253 | m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene, pId); | 253 | m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene, pId); |
@@ -361,7 +361,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
361 | string capUrl = "/CAPS/" + UUID.Random() + "/"; | 361 | string capUrl = "/CAPS/" + UUID.Random() + "/"; |
362 | 362 | ||
363 | // Register this as a poll service | 363 | // Register this as a poll service |
364 | PollServiceMeshEventArgs args = new PollServiceMeshEventArgs(agentID, m_scene); | 364 | PollServiceMeshEventArgs args = new PollServiceMeshEventArgs(capUrl, agentID, m_scene); |
365 | 365 | ||
366 | args.Type = PollServiceEventArgs.EventType.Mesh; | 366 | args.Type = PollServiceEventArgs.EventType.Mesh; |
367 | MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); | 367 | MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 0570144..e053054 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -84,6 +84,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
84 | 84 | ||
85 | private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>(); | 85 | private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>(); |
86 | 86 | ||
87 | private string m_URL; | ||
88 | |||
87 | #region ISharedRegionModule Members | 89 | #region ISharedRegionModule Members |
88 | 90 | ||
89 | public void Initialise(IConfigSource source) | 91 | public void Initialise(IConfigSource source) |
@@ -215,7 +217,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
215 | private Scene m_scene; | 217 | private Scene m_scene; |
216 | private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000); | 218 | private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000); |
217 | public PollServiceTextureEventArgs(UUID pId, Scene scene) : | 219 | public PollServiceTextureEventArgs(UUID pId, Scene scene) : |
218 | base(null, null, null, null, pId, int.MaxValue) | 220 | base(null, "", null, null, null, pId, int.MaxValue) |
219 | { | 221 | { |
220 | m_scene = scene; | 222 | m_scene = scene; |
221 | // x is request id, y is userid | 223 | // x is request id, y is userid |
@@ -368,7 +370,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
368 | port = MainServer.Instance.SSLPort; | 370 | port = MainServer.Instance.SSLPort; |
369 | protocol = "https"; | 371 | protocol = "https"; |
370 | } | 372 | } |
371 | caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); | 373 | IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>(); |
374 | if (handler != null) | ||
375 | handler.RegisterExternalUserCapsHandler(agentID, caps, "GetTexture", capUrl); | ||
376 | else | ||
377 | caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); | ||
372 | m_pollservices[agentID] = args; | 378 | m_pollservices[agentID] = args; |
373 | m_capsDict[agentID] = capUrl; | 379 | m_capsDict[agentID] = capUrl; |
374 | } | 380 | } |
@@ -380,13 +386,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
380 | 386 | ||
381 | private void DeregisterCaps(UUID agentID, Caps caps) | 387 | private void DeregisterCaps(UUID agentID, Caps caps) |
382 | { | 388 | { |
383 | string capUrl; | ||
384 | PollServiceTextureEventArgs args; | 389 | PollServiceTextureEventArgs args; |
385 | if (m_capsDict.TryGetValue(agentID, out capUrl)) | 390 | |
386 | { | 391 | MainServer.Instance.RemoveHTTPHandler("", m_URL); |
387 | MainServer.Instance.RemoveHTTPHandler("", capUrl); | 392 | m_capsDict.Remove(agentID); |
388 | m_capsDict.Remove(agentID); | 393 | |
389 | } | ||
390 | if (m_pollservices.TryGetValue(agentID, out args)) | 394 | if (m_pollservices.TryGetValue(agentID, out args)) |
391 | { | 395 | { |
392 | m_pollservices.Remove(agentID); | 396 | m_pollservices.Remove(agentID); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs index 79d56c4..5196368 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/RegionConsoleModule.cs | |||
@@ -183,7 +183,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
183 | m_isGod = m_scene.Permissions.IsGod(agentID); | 183 | m_isGod = m_scene.Permissions.IsGod(agentID); |
184 | } | 184 | } |
185 | 185 | ||
186 | public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 186 | protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
187 | { | 187 | { |
188 | StreamReader reader = new StreamReader(request); | 188 | StreamReader reader = new StreamReader(request); |
189 | string message = reader.ReadToEnd(); | 189 | string message = reader.ReadToEnd(); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 7d9f935..e4d8a20 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | |||
@@ -68,7 +68,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
68 | /// </summary> | 68 | /// </summary> |
69 | private OSDMap m_features = new OSDMap(); | 69 | private OSDMap m_features = new OSDMap(); |
70 | 70 | ||
71 | private string m_MapImageServerURL = string.Empty; | ||
72 | private string m_SearchURL = string.Empty; | 71 | private string m_SearchURL = string.Empty; |
73 | private bool m_ExportSupported = false; | 72 | private bool m_ExportSupported = false; |
74 | 73 | ||
@@ -78,15 +77,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
78 | { | 77 | { |
79 | IConfig config = source.Configs["SimulatorFeatures"]; | 78 | IConfig config = source.Configs["SimulatorFeatures"]; |
80 | if (config != null) | 79 | if (config != null) |
81 | { | 80 | { |
82 | m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty); | ||
83 | if (m_MapImageServerURL != string.Empty) | ||
84 | { | ||
85 | m_MapImageServerURL = m_MapImageServerURL.Trim(); | ||
86 | if (!m_MapImageServerURL.EndsWith("/")) | ||
87 | m_MapImageServerURL = m_MapImageServerURL + "/"; | ||
88 | } | ||
89 | |||
90 | m_SearchURL = config.GetString("SearchServerURI", string.Empty); | 81 | m_SearchURL = config.GetString("SearchServerURI", string.Empty); |
91 | 82 | ||
92 | m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); | 83 | m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); |
@@ -149,15 +140,16 @@ namespace OpenSim.Region.ClientStack.Linden | |||
149 | m_features["PhysicsShapeTypes"] = typesMap; | 140 | m_features["PhysicsShapeTypes"] = typesMap; |
150 | 141 | ||
151 | // Extra information for viewers that want to use it | 142 | // Extra information for viewers that want to use it |
152 | OSDMap gridServicesMap = new OSDMap(); | 143 | // TODO: Take these out of here into their respective modules, like map-server-url |
153 | if (m_MapImageServerURL != string.Empty) | 144 | OSDMap extrasMap = new OSDMap(); |
154 | gridServicesMap["map-server-url"] = m_MapImageServerURL; | ||
155 | if (m_SearchURL != string.Empty) | 145 | if (m_SearchURL != string.Empty) |
156 | gridServicesMap["search"] = m_SearchURL; | 146 | extrasMap["search-server-url"] = m_SearchURL; |
157 | m_features["GridServices"] = gridServicesMap; | ||
158 | |||
159 | if (m_ExportSupported) | 147 | if (m_ExportSupported) |
160 | m_features["ExportSupported"] = true; | 148 | extrasMap["ExportSupported"] = true; |
149 | |||
150 | if (extrasMap.Count > 0) | ||
151 | m_features["OpenSimExtras"] = extrasMap; | ||
152 | |||
161 | } | 153 | } |
162 | } | 154 | } |
163 | 155 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index eca576d..cf95463 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | |||
@@ -64,11 +64,18 @@ namespace OpenSim.Region.ClientStack.Linden | |||
64 | 64 | ||
65 | private Scene m_scene; | 65 | private Scene m_scene; |
66 | private bool m_persistBakedTextures; | 66 | private bool m_persistBakedTextures; |
67 | private string m_URL; | ||
67 | 68 | ||
68 | private IBakedTextureModule m_BakedTextureModule; | 69 | private IBakedTextureModule m_BakedTextureModule; |
69 | 70 | ||
70 | public void Initialise(IConfigSource source) | 71 | public void Initialise(IConfigSource source) |
71 | { | 72 | { |
73 | IConfig config = source.Configs["ClientStack.LindenCaps"]; | ||
74 | if (config == null) | ||
75 | return; | ||
76 | |||
77 | m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty); | ||
78 | |||
72 | IConfig appearanceConfig = source.Configs["Appearance"]; | 79 | IConfig appearanceConfig = source.Configs["Appearance"]; |
73 | if (appearanceConfig != null) | 80 | if (appearanceConfig != null) |
74 | m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); | 81 | m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); |
@@ -280,23 +287,28 @@ namespace OpenSim.Region.ClientStack.Linden | |||
280 | 287 | ||
281 | public void RegisterCaps(UUID agentID, Caps caps) | 288 | public void RegisterCaps(UUID agentID, Caps caps) |
282 | { | 289 | { |
283 | UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( | 290 | UUID capID = UUID.Random(); |
284 | caps, m_scene.AssetService, m_persistBakedTextures); | ||
285 | 291 | ||
286 | 292 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | |
287 | 293 | if (m_URL == "localhost") | |
288 | caps.RegisterHandler( | 294 | { |
289 | "UploadBakedTexture", | 295 | UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( |
290 | new RestStreamHandler( | 296 | caps, m_scene.AssetService, m_persistBakedTextures); |
291 | "POST", | ||
292 | "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, | ||
293 | avatarhandler.UploadBakedTexture, | ||
294 | "UploadBakedTexture", | ||
295 | agentID.ToString())); | ||
296 | |||
297 | |||
298 | |||
299 | 297 | ||
298 | caps.RegisterHandler( | ||
299 | "UploadBakedTexture", | ||
300 | new RestStreamHandler( | ||
301 | "POST", | ||
302 | "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, | ||
303 | avatarhandler.UploadBakedTexture, | ||
304 | "UploadBakedTexture", | ||
305 | agentID.ToString())); | ||
306 | |||
307 | } | ||
308 | else | ||
309 | { | ||
310 | caps.RegisterHandler("UploadBakedTexture", m_URL); | ||
311 | } | ||
300 | } | 312 | } |
301 | } | 313 | } |
302 | } \ No newline at end of file | 314 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 707cc93..f816ad3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | |||
@@ -71,9 +71,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
71 | private IInventoryService m_InventoryService; | 71 | private IInventoryService m_InventoryService; |
72 | private ILibraryService m_LibraryService; | 72 | private ILibraryService m_LibraryService; |
73 | 73 | ||
74 | private bool m_Enabled; | ||
75 | |||
76 | private string m_fetchInventoryDescendents2Url; | ||
77 | private string m_webFetchInventoryDescendentsUrl; | ||
78 | |||
74 | private static WebFetchInvDescHandler m_webFetchHandler; | 79 | private static WebFetchInvDescHandler m_webFetchHandler; |
75 | 80 | ||
76 | private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); | ||
77 | private static Thread[] m_workerThreads = null; | 81 | private static Thread[] m_workerThreads = null; |
78 | 82 | ||
79 | private static DoubleQueue<aPollRequest> m_queue = | 83 | private static DoubleQueue<aPollRequest> m_queue = |
@@ -83,22 +87,45 @@ namespace OpenSim.Region.ClientStack.Linden | |||
83 | 87 | ||
84 | public void Initialise(IConfigSource source) | 88 | public void Initialise(IConfigSource source) |
85 | { | 89 | { |
90 | IConfig config = source.Configs["ClientStack.LindenCaps"]; | ||
91 | if (config == null) | ||
92 | return; | ||
93 | |||
94 | m_fetchInventoryDescendents2Url = config.GetString("Cap_FetchInventoryDescendents2", string.Empty); | ||
95 | m_webFetchInventoryDescendentsUrl = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty); | ||
96 | |||
97 | if (m_fetchInventoryDescendents2Url != string.Empty || m_webFetchInventoryDescendentsUrl != string.Empty) | ||
98 | { | ||
99 | m_Enabled = true; | ||
100 | } | ||
86 | } | 101 | } |
87 | 102 | ||
88 | public void AddRegion(Scene s) | 103 | public void AddRegion(Scene s) |
89 | { | 104 | { |
105 | if (!m_Enabled) | ||
106 | return; | ||
107 | |||
90 | m_scene = s; | 108 | m_scene = s; |
91 | } | 109 | } |
92 | 110 | ||
93 | public void RemoveRegion(Scene s) | 111 | public void RemoveRegion(Scene s) |
94 | { | 112 | { |
113 | if (!m_Enabled) | ||
114 | return; | ||
115 | |||
95 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | 116 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; |
96 | m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; | 117 | |
118 | foreach (Thread t in m_workerThreads) | ||
119 | Watchdog.AbortThread(t.ManagedThreadId); | ||
120 | |||
97 | m_scene = null; | 121 | m_scene = null; |
98 | } | 122 | } |
99 | 123 | ||
100 | public void RegionLoaded(Scene s) | 124 | public void RegionLoaded(Scene s) |
101 | { | 125 | { |
126 | if (!m_Enabled) | ||
127 | return; | ||
128 | |||
102 | m_InventoryService = m_scene.InventoryService; | 129 | m_InventoryService = m_scene.InventoryService; |
103 | m_LibraryService = m_scene.LibraryService; | 130 | m_LibraryService = m_scene.LibraryService; |
104 | 131 | ||
@@ -106,7 +133,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
106 | m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); | 133 | m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); |
107 | 134 | ||
108 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | 135 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; |
109 | m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; | ||
110 | 136 | ||
111 | if (m_workerThreads == null) | 137 | if (m_workerThreads == null) |
112 | { | 138 | { |
@@ -140,12 +166,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
140 | 166 | ||
141 | #endregion | 167 | #endregion |
142 | 168 | ||
143 | ~WebFetchInvDescModule() | ||
144 | { | ||
145 | foreach (Thread t in m_workerThreads) | ||
146 | Watchdog.AbortThread(t.ManagedThreadId); | ||
147 | } | ||
148 | |||
149 | private class PollServiceInventoryEventArgs : PollServiceEventArgs | 169 | private class PollServiceInventoryEventArgs : PollServiceEventArgs |
150 | { | 170 | { |
151 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 171 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -155,8 +175,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
155 | 175 | ||
156 | private Scene m_scene; | 176 | private Scene m_scene; |
157 | 177 | ||
158 | public PollServiceInventoryEventArgs(Scene scene, UUID pId) : | 178 | public PollServiceInventoryEventArgs(Scene scene, string url, UUID pId) : |
159 | base(null, null, null, null, pId, int.MaxValue) | 179 | base(null, url, null, null, null, pId, int.MaxValue) |
160 | { | 180 | { |
161 | m_scene = scene; | 181 | m_scene = scene; |
162 | 182 | ||
@@ -284,47 +304,53 @@ namespace OpenSim.Region.ClientStack.Linden | |||
284 | 304 | ||
285 | private void RegisterCaps(UUID agentID, Caps caps) | 305 | private void RegisterCaps(UUID agentID, Caps caps) |
286 | { | 306 | { |
287 | string capUrl = "/CAPS/" + UUID.Random() + "/"; | 307 | if (m_fetchInventoryDescendents2Url == "") |
308 | return; | ||
288 | 309 | ||
289 | // Register this as a poll service | 310 | // Register this as a poll service |
290 | PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(m_scene, agentID); | 311 | PollServiceInventoryEventArgs args |
291 | 312 | = new PollServiceInventoryEventArgs(m_scene, "/CAPS/" + UUID.Random() + "/", agentID); | |
292 | args.Type = PollServiceEventArgs.EventType.Inventory; | 313 | args.Type = PollServiceEventArgs.EventType.Inventory; |
293 | MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); | ||
294 | |||
295 | string hostName = m_scene.RegionInfo.ExternalHostName; | ||
296 | uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; | ||
297 | string protocol = "http"; | ||
298 | |||
299 | if (MainServer.Instance.UseSSL) | ||
300 | { | ||
301 | hostName = MainServer.Instance.SSLCommonName; | ||
302 | port = MainServer.Instance.SSLPort; | ||
303 | protocol = "https"; | ||
304 | } | ||
305 | caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); | ||
306 | 314 | ||
307 | m_capsDict[agentID] = capUrl; | 315 | caps.RegisterPollHandler("FetchInventoryDescendents2", args); |
316 | |||
317 | // MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); | ||
318 | // | ||
319 | // string hostName = m_scene.RegionInfo.ExternalHostName; | ||
320 | // uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; | ||
321 | // string protocol = "http"; | ||
322 | // | ||
323 | // if (MainServer.Instance.UseSSL) | ||
324 | // { | ||
325 | // hostName = MainServer.Instance.SSLCommonName; | ||
326 | // port = MainServer.Instance.SSLPort; | ||
327 | // protocol = "https"; | ||
328 | // } | ||
329 | // | ||
330 | // caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); | ||
308 | } | 331 | } |
309 | 332 | ||
310 | private void DeregisterCaps(UUID agentID, Caps caps) | 333 | // private void DeregisterCaps(UUID agentID, Caps caps) |
311 | { | 334 | // { |
312 | string capUrl; | 335 | // string capUrl; |
313 | 336 | // | |
314 | if (m_capsDict.TryGetValue(agentID, out capUrl)) | 337 | // if (m_capsDict.TryGetValue(agentID, out capUrl)) |
315 | { | 338 | // { |
316 | MainServer.Instance.RemoveHTTPHandler("", capUrl); | 339 | // MainServer.Instance.RemoveHTTPHandler("", capUrl); |
317 | m_capsDict.Remove(agentID); | 340 | // m_capsDict.Remove(agentID); |
318 | } | 341 | // } |
319 | } | 342 | // } |
320 | 343 | ||
321 | private void DoInventoryRequests() | 344 | private void DoInventoryRequests() |
322 | { | 345 | { |
323 | while (true) | 346 | while (true) |
324 | { | 347 | { |
348 | Watchdog.UpdateThread(); | ||
349 | |||
325 | aPollRequest poolreq = m_queue.Dequeue(); | 350 | aPollRequest poolreq = m_queue.Dequeue(); |
326 | 351 | ||
327 | poolreq.thepoll.Process(poolreq); | 352 | if (poolreq != null && poolreq.thepoll != null) |
353 | poolreq.thepoll.Process(poolreq); | ||
328 | } | 354 | } |
329 | } | 355 | } |
330 | } | 356 | } |