aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps
diff options
context:
space:
mode:
authorMelanie2013-07-24 03:50:09 +0100
committerMelanie2013-07-24 03:50:09 +0100
commita7eb1b5b855b3caa6c4622789ef1377830e2f435 (patch)
tree2bd58bcd2bd9b37adeb746f4b399b1d98539d1cf /OpenSim/Region/ClientStack/Linden/Caps
parentMerge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into ... (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-a7eb1b5b855b3caa6c4622789ef1377830e2f435.zip
opensim-SC-a7eb1b5b855b3caa6c4622789ef1377830e2f435.tar.gz
opensim-SC-a7eb1b5b855b3caa6c4622789ef1377830e2f435.tar.bz2
opensim-SC-a7eb1b5b855b3caa6c4622789ef1377830e2f435.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs13
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs85
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs6
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs67
5 files changed, 76 insertions, 97 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 98ab433..762e22a 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -367,18 +367,7 @@ namespace OpenSim.Region.ClientStack.Linden
367 foreach (OSD c in capsRequested) 367 foreach (OSD c in capsRequested)
368 validCaps.Add(c.AsString()); 368 validCaps.Add(c.AsString());
369 369
370 Hashtable caps = m_HostCapsObj.CapsHandlers.GetCapsDetails(true, validCaps); 370 string result = LLSDHelpers.SerialiseLLSDReply(m_HostCapsObj.GetCapsDetails(true, validCaps));
371
372 // Add the external too
373 foreach (KeyValuePair<string, string> kvp in m_HostCapsObj.ExternalCapsHandlers)
374 {
375 if (!validCaps.Contains(kvp.Key))
376 continue;
377
378 caps[kvp.Key] = kvp.Value;
379 }
380
381 string result = LLSDHelpers.SerialiseLLSDReply(caps);
382 371
383 //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); 372 //m_log.DebugFormat("[CAPS] CapsRequest {0}", result);
384 373
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index d6689d4..e98a470 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>();
@@ -252,29 +259,32 @@ namespace OpenSim.Region.ClientStack.Linden
252 259
253 List<UUID> removeitems = new List<UUID>(); 260 List<UUID> removeitems = new List<UUID>();
254 lock (m_AvatarQueueUUIDMapping) 261 lock (m_AvatarQueueUUIDMapping)
255 { 262 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 263
265 foreach (UUID ky in removeitems) 264// lock (m_AvatarQueueUUIDMapping)
266 { 265// {
267 UUID eventQueueGetUuid = m_AvatarQueueUUIDMapping[ky]; 266// foreach (UUID ky in m_AvatarQueueUUIDMapping.Keys)
268 m_AvatarQueueUUIDMapping.Remove(ky); 267// {
269 268//// m_log.DebugFormat("[EVENTQUEUE]: Found key {0} in m_AvatarQueueUUIDMapping while looking for {1}", ky, AgentID);
270 string eqgPath = GenerateEqgCapPath(eventQueueGetUuid); 269// if (ky == agentID)
271 MainServer.Instance.RemovePollServiceHTTPHandler("", eqgPath); 270// {
272 271// removeitems.Add(ky);
273// m_log.DebugFormat( 272// }
274// "[EVENT QUEUE GET MODULE]: Removed EQG handler {0} for {1} in {2}", 273// }
275// eqgPath, agentID, m_scene.RegionInfo.RegionName); 274//
276 } 275// foreach (UUID ky in removeitems)
277 } 276// {
277// UUID eventQueueGetUuid = m_AvatarQueueUUIDMapping[ky];
278// m_AvatarQueueUUIDMapping.Remove(ky);
279//
280// string eqgPath = GenerateEqgCapPath(eventQueueGetUuid);
281// MainServer.Instance.RemovePollServiceHTTPHandler("", eqgPath);
282//
283//// m_log.DebugFormat(
284//// "[EVENT QUEUE GET MODULE]: Removed EQG handler {0} for {1} in {2}",
285//// eqgPath, agentID, m_scene.RegionInfo.RegionName);
286// }
287// }
278 288
279 UUID searchval = UUID.Zero; 289 UUID searchval = UUID.Zero;
280 290
@@ -359,29 +369,9 @@ namespace OpenSim.Region.ClientStack.Linden
359 m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID); 369 m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID);
360 } 370 }
361 371
362 string eventQueueGetPath = GenerateEqgCapPath(eventQueueGetUUID); 372 caps.RegisterPollHandler(
363 373 "EventQueueGet",
364 // Register this as a caps handler 374 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(
370 "EventQueueGet", new RestHTTPHandler("POST", eventQueueGetPath, null, "EventQueueGet", null));
371// delegate(Hashtable m_dhttpMethod)
372// {
373// return ProcessQueue(m_dhttpMethod, agentID, caps);
374// }));
375
376 // This will persist this beyond the expiry of the caps handlers
377 // TODO: Add EventQueueGet name/description for diagnostics
378 MainServer.Instance.AddPollServiceHTTPHandler(
379 eventQueueGetPath,
380 new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID, 40000));
381
382// m_log.DebugFormat(
383// "[EVENT QUEUE GET MODULE]: Registered EQG handler {0} for {1} in {2}",
384// eventQueueGetPath, agentID, m_scene.RegionInfo.RegionName);
385 375
386 Random rnd = new Random(Environment.TickCount); 376 Random rnd = new Random(Environment.TickCount);
387 lock (m_ids) 377 lock (m_ids)
@@ -399,7 +389,10 @@ namespace OpenSim.Region.ClientStack.Linden
399 Queue<OSD> queue = GetQueue(agentID); 389 Queue<OSD> queue = GetQueue(agentID);
400 if (queue != null) 390 if (queue != null)
401 lock (queue) 391 lock (queue)
392 {
393 //m_log.WarnFormat("POLLED FOR EVENTS BY {0} in {1} -- {2}", agentID, m_scene.RegionInfo.RegionName, queue.Count);
402 return queue.Count > 0; 394 return queue.Count > 0;
395 }
403 396
404 return false; 397 return false;
405 } 398 }
@@ -422,7 +415,7 @@ namespace OpenSim.Region.ClientStack.Linden
422 public Hashtable GetEvents(UUID requestID, UUID pAgentId) 415 public Hashtable GetEvents(UUID requestID, UUID pAgentId)
423 { 416 {
424 if (DebugLevel >= 2) 417 if (DebugLevel >= 2)
425 m_log.DebugFormat("POLLED FOR EQ MESSAGES BY {0} in {1}", pAgentId, m_scene.RegionInfo.RegionName); 418 m_log.WarnFormat("POLLED FOR EQ MESSAGES BY {0} in {1}", pAgentId, m_scene.RegionInfo.RegionName);
426 419
427 Queue<OSD> queue = TryGetQueue(pAgentId); 420 Queue<OSD> queue = TryGetQueue(pAgentId);
428 OSD element; 421 OSD element;
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 a42c96c..c12b8d6 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -210,7 +210,7 @@ namespace OpenSim.Region.ClientStack.Linden
210 private Scene m_scene; 210 private Scene m_scene;
211 private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000); 211 private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000);
212 public PollServiceTextureEventArgs(UUID pId, Scene scene) : 212 public PollServiceTextureEventArgs(UUID pId, Scene scene) :
213 base(null, null, null, null, pId, int.MaxValue) 213 base(null, "", null, null, null, pId, int.MaxValue)
214 { 214 {
215 m_scene = scene; 215 m_scene = scene;
216 // x is request id, y is userid 216 // x is request id, y is userid
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 27b09a6..f816ad3 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -78,7 +78,6 @@ namespace OpenSim.Region.ClientStack.Linden
78 78
79 private static WebFetchInvDescHandler m_webFetchHandler; 79 private static WebFetchInvDescHandler m_webFetchHandler;
80 80
81 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
82 private static Thread[] m_workerThreads = null; 81 private static Thread[] m_workerThreads = null;
83 82
84 private static DoubleQueue<aPollRequest> m_queue = 83 private static DoubleQueue<aPollRequest> m_queue =
@@ -115,7 +114,6 @@ namespace OpenSim.Region.ClientStack.Linden
115 return; 114 return;
116 115
117 m_scene.EventManager.OnRegisterCaps -= RegisterCaps; 116 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
118 m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
119 117
120 foreach (Thread t in m_workerThreads) 118 foreach (Thread t in m_workerThreads)
121 Watchdog.AbortThread(t.ManagedThreadId); 119 Watchdog.AbortThread(t.ManagedThreadId);
@@ -135,7 +133,6 @@ namespace OpenSim.Region.ClientStack.Linden
135 m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); 133 m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
136 134
137 m_scene.EventManager.OnRegisterCaps += RegisterCaps; 135 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
138 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
139 136
140 if (m_workerThreads == null) 137 if (m_workerThreads == null)
141 { 138 {
@@ -178,8 +175,8 @@ namespace OpenSim.Region.ClientStack.Linden
178 175
179 private Scene m_scene; 176 private Scene m_scene;
180 177
181 public PollServiceInventoryEventArgs(Scene scene, UUID pId) : 178 public PollServiceInventoryEventArgs(Scene scene, string url, UUID pId) :
182 base(null, null, null, null, pId, int.MaxValue) 179 base(null, url, null, null, null, pId, int.MaxValue)
183 { 180 {
184 m_scene = scene; 181 m_scene = scene;
185 182
@@ -310,40 +307,39 @@ namespace OpenSim.Region.ClientStack.Linden
310 if (m_fetchInventoryDescendents2Url == "") 307 if (m_fetchInventoryDescendents2Url == "")
311 return; 308 return;
312 309
313 string capUrl = "/CAPS/" + UUID.Random() + "/";
314
315 // Register this as a poll service 310 // Register this as a poll service
316 PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(m_scene, agentID); 311 PollServiceInventoryEventArgs args
317 312 = new PollServiceInventoryEventArgs(m_scene, "/CAPS/" + UUID.Random() + "/", agentID);
318 args.Type = PollServiceEventArgs.EventType.Inventory; 313 args.Type = PollServiceEventArgs.EventType.Inventory;
319 MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
320
321 string hostName = m_scene.RegionInfo.ExternalHostName;
322 uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
323 string protocol = "http";
324
325 if (MainServer.Instance.UseSSL)
326 {
327 hostName = MainServer.Instance.SSLCommonName;
328 port = MainServer.Instance.SSLPort;
329 protocol = "https";
330 }
331
332 caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
333 314
334 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));
335 } 331 }
336 332
337 private void DeregisterCaps(UUID agentID, Caps caps) 333// private void DeregisterCaps(UUID agentID, Caps caps)
338 { 334// {
339 string capUrl; 335// string capUrl;
340 336//
341 if (m_capsDict.TryGetValue(agentID, out capUrl)) 337// if (m_capsDict.TryGetValue(agentID, out capUrl))
342 { 338// {
343 MainServer.Instance.RemoveHTTPHandler("", capUrl); 339// MainServer.Instance.RemoveHTTPHandler("", capUrl);
344 m_capsDict.Remove(agentID); 340// m_capsDict.Remove(agentID);
345 } 341// }
346 } 342// }
347 343
348 private void DoInventoryRequests() 344 private void DoInventoryRequests()
349 { 345 {
@@ -353,7 +349,8 @@ namespace OpenSim.Region.ClientStack.Linden
353 349
354 aPollRequest poolreq = m_queue.Dequeue(); 350 aPollRequest poolreq = m_queue.Dequeue();
355 351
356 poolreq.thepoll.Process(poolreq); 352 if (poolreq != null && poolreq.thepoll != null)
353 poolreq.thepoll.Process(poolreq);
357 } 354 }
358 } 355 }
359 } 356 }