aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-03-09 22:59:23 +0000
committerMelanie2012-03-09 22:59:23 +0000
commit5c5a49379118330627af0b5648e6ce83a3b209ea (patch)
tree2791f811ea42039e59098490cf0835add25c319f /OpenSim
parentfix for NPC not playing internal animations (diff)
parentMore on inventory transfer hold ups: (diff)
downloadopensim-SC-5c5a49379118330627af0b5648e6ce83a3b209ea.zip
opensim-SC-5c5a49379118330627af0b5648e6ce83a3b209ea.tar.gz
opensim-SC-5c5a49379118330627af0b5648e6ce83a3b209ea.tar.bz2
opensim-SC-5c5a49379118330627af0b5648e6ce83a3b209ea.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs20
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs59
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs2
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs10
4 files changed, 85 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index b5c0af6..4be3804 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -58,6 +58,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
58 58
59 private List<Scene> m_Scenes = new List<Scene>(); 59 private List<Scene> m_Scenes = new List<Scene>();
60 60
61 private InventoryCache m_Cache = new InventoryCache();
62
61 protected IUserManagement m_UserManagement; 63 protected IUserManagement m_UserManagement;
62 protected IUserManagement UserManagementModule 64 protected IUserManagement UserManagementModule
63 { 65 {
@@ -312,6 +314,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
312 public InventoryFolderBase GetRootFolder(UUID userID) 314 public InventoryFolderBase GetRootFolder(UUID userID)
313 { 315 {
314 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID); 316 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID);
317 InventoryFolderBase root = m_Cache.GetRootFolder(userID);
318 if (root != null)
319 return root;
315 320
316 string invURL = GetInventoryServiceURL(userID); 321 string invURL = GetInventoryServiceURL(userID);
317 322
@@ -320,12 +325,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
320 325
321 IInventoryService connector = GetConnector(invURL); 326 IInventoryService connector = GetConnector(invURL);
322 327
323 return connector.GetRootFolder(userID); 328 root = connector.GetRootFolder(userID);
329
330 m_Cache.Cache(userID, root);
331
332 return root;
324 } 333 }
325 334
326 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 335 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
327 { 336 {
328 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type); 337 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type);
338 InventoryFolderBase f = m_Cache.GetFolderForType(userID, type);
339 if (f != null)
340 return f;
329 341
330 string invURL = GetInventoryServiceURL(userID); 342 string invURL = GetInventoryServiceURL(userID);
331 343
@@ -334,7 +346,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
334 346
335 IInventoryService connector = GetConnector(invURL); 347 IInventoryService connector = GetConnector(invURL);
336 348
337 return connector.GetFolderForType(userID, type); 349 f = connector.GetFolderForType(userID, type);
350
351 m_Cache.Cache(userID, type, f);
352
353 return f;
338 } 354 }
339 355
340 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 356 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
new file mode 100644
index 0000000..0fe778d
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -0,0 +1,59 @@
1using System;
2using System.Collections.Generic;
3
4using OpenSim.Framework;
5using OpenMetaverse;
6
7namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
8{
9 public class InventoryCache
10 {
11 private const double CACHE_EXPIRATION_SECONDS = 3600.0; // 1 hour
12
13 private static ExpiringCache<UUID, InventoryFolderBase> m_RootFolders = new ExpiringCache<UUID, InventoryFolderBase>();
14 private static ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>>();
15
16 public void Cache(UUID userID, InventoryFolderBase root)
17 {
18 lock (m_RootFolders)
19 m_RootFolders.AddOrUpdate(userID, root, CACHE_EXPIRATION_SECONDS);
20 }
21
22 public InventoryFolderBase GetRootFolder(UUID userID)
23 {
24 InventoryFolderBase root = null;
25 if (m_RootFolders.TryGetValue(userID, out root))
26 return root;
27
28 return null;
29 }
30
31 public void Cache(UUID userID, AssetType type, InventoryFolderBase folder)
32 {
33 lock (m_FolderTypes)
34 {
35 Dictionary<AssetType, InventoryFolderBase> ff = null;
36 if (!m_FolderTypes.TryGetValue(userID, out ff))
37 {
38 ff = new Dictionary<AssetType, InventoryFolderBase>();
39 m_FolderTypes.Add(userID, ff, CACHE_EXPIRATION_SECONDS);
40 }
41 if (!ff.ContainsKey(type))
42 ff.Add(type, folder);
43 }
44 }
45
46 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
47 {
48 Dictionary<AssetType, InventoryFolderBase> ff = null;
49 if (m_FolderTypes.TryGetValue(userID, out ff))
50 {
51 InventoryFolderBase f = null;
52 if (ff.TryGetValue(type, out f))
53 return f;
54 }
55
56 return null;
57 }
58 }
59}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 23f39a8..6ae4adc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -633,7 +633,7 @@ namespace OpenSim.Region.Framework.Scenes
633 { 633 {
634 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); 634 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
635 if (invAccess != null) 635 if (invAccess != null)
636 invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); 636 Util.FireAndForget(delegate { invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); });
637 } 637 }
638 638
639 if (!Permissions.BypassPermissions()) 639 if (!Permissions.BypassPermissions())
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index a662abb..39e983b 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -48,6 +48,8 @@ namespace OpenSim.Services.Connectors
48 48
49 private string m_ServerURI = String.Empty; 49 private string m_ServerURI = String.Empty;
50 50
51 private object m_Lock = new object();
52
51 public XInventoryServicesConnector() 53 public XInventoryServicesConnector()
52 { 54 {
53 } 55 }
@@ -514,9 +516,11 @@ namespace OpenSim.Services.Connectors
514 { 516 {
515 sendData["METHOD"] = method; 517 sendData["METHOD"] = method;
516 518
517 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 519 string reply = string.Empty;
518 m_ServerURI + "/xinventory", 520 lock (m_Lock)
519 ServerUtils.BuildQueryString(sendData)); 521 reply = SynchronousRestFormsRequester.MakeRequest("POST",
522 m_ServerURI + "/xinventory",
523 ServerUtils.BuildQueryString(sendData));
520 524
521 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( 525 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
522 reply); 526 reply);