diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs | 47 |
2 files changed, 46 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 907c8f4..1696d82 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -45,6 +45,7 @@ using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; | |||
45 | using OpenSim.Region.CoreModules.World.Serialiser; | 45 | using OpenSim.Region.CoreModules.World.Serialiser; |
46 | using OpenSim.Region.Framework.Scenes; | 46 | using OpenSim.Region.Framework.Scenes; |
47 | using OpenSim.Region.Framework.Scenes.Serialization; | 47 | using OpenSim.Region.Framework.Scenes.Serialization; |
48 | using OpenSim.Services.Interfaces; | ||
48 | using OpenSim.Tests.Common; | 49 | using OpenSim.Tests.Common; |
49 | using OpenSim.Tests.Common.Mock; | 50 | using OpenSim.Tests.Common.Mock; |
50 | using OpenSim.Tests.Common.Setup; | 51 | using OpenSim.Tests.Common.Setup; |
@@ -102,6 +103,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
102 | Monitor.Wait(this, 60000); | 103 | Monitor.Wait(this, 60000); |
103 | } | 104 | } |
104 | 105 | ||
106 | Console.WriteLine("here"); | ||
107 | |||
105 | // Create asset | 108 | // Create asset |
106 | SceneObjectGroup object1; | 109 | SceneObjectGroup object1; |
107 | SceneObjectPart part1; | 110 | SceneObjectPart part1; |
@@ -135,8 +138,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
135 | item1.AssetID = asset1.FullID; | 138 | item1.AssetID = asset1.FullID; |
136 | item1.ID = item1Id; | 139 | item1.ID = item1Id; |
137 | //userInfo.RootFolder.FindFolderByPath("Objects").ID; | 140 | //userInfo.RootFolder.FindFolderByPath("Objects").ID; |
138 | InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); | 141 | //InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); |
139 | //InventoryFolderBase rootFolder = scene.InventoryService.GetRootFolder(userId); | 142 | Console.WriteLine("here2"); |
143 | IInventoryService inventoryService = scene.InventoryService; | ||
144 | InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId); | ||
145 | InventoryCollection rootContents = inventoryService.GetFolderContent(userId, rootFolder.ID); | ||
146 | InventoryFolderBase objsFolder = null; | ||
147 | foreach (InventoryFolderBase folder in rootContents.Folders) | ||
148 | if (folder.Name == "Objects") | ||
149 | objsFolder = folder; | ||
140 | item1.Folder = objsFolder.ID; | 150 | item1.Folder = objsFolder.ID; |
141 | scene.AddInventoryItem(userId, item1); | 151 | scene.AddInventoryItem(userId, item1); |
142 | 152 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index c8f04a5..73ffc5e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs | |||
@@ -88,13 +88,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
88 | } | 88 | } |
89 | 89 | ||
90 | // If not, go get them and place them in the cache | 90 | // If not, go get them and place them in the cache |
91 | Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID); | 91 | Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID); |
92 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", | 92 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", |
93 | presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); | 93 | presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); |
94 | |||
95 | if (folders.Count > 0) | ||
96 | lock (m_InventoryCache) | ||
97 | m_InventoryCache.Add(presence.UUID, folders); | ||
98 | } | 94 | } |
99 | 95 | ||
100 | void OnClientClosed(UUID clientID, Scene scene) | 96 | void OnClientClosed(UUID clientID, Scene scene) |
@@ -113,26 +109,51 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
113 | } | 109 | } |
114 | } | 110 | } |
115 | 111 | ||
116 | // Drop system folders | 112 | m_log.DebugFormat( |
113 | "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", | ||
114 | scene.RegionInfo.RegionName, clientID); | ||
115 | DropCachedSystemFolders(clientID); | ||
116 | } | ||
117 | } | ||
118 | |||
119 | /// <summary> | ||
120 | /// Cache a user's 'system' folders. | ||
121 | /// </summary> | ||
122 | /// <param name="userID"></param> | ||
123 | /// <returns>Folders cached</returns> | ||
124 | protected Dictionary<AssetType, InventoryFolderBase> CacheSystemFolders(UUID userID) | ||
125 | { | ||
126 | // If not, go get them and place them in the cache | ||
127 | Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(userID); | ||
128 | |||
129 | if (folders.Count > 0) | ||
117 | lock (m_InventoryCache) | 130 | lock (m_InventoryCache) |
118 | if (m_InventoryCache.ContainsKey(clientID)) | 131 | m_InventoryCache.Add(userID, folders); |
119 | { | ||
120 | m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", | ||
121 | scene.RegionInfo.RegionName, clientID); | ||
122 | 132 | ||
123 | m_InventoryCache.Remove(clientID); | 133 | return folders; |
124 | } | ||
125 | } | ||
126 | } | 134 | } |
127 | 135 | ||
136 | /// <summary> | ||
137 | /// Drop a user's cached 'system' folders | ||
138 | /// </summary> | ||
139 | /// <param name="userID"></param> | ||
140 | protected void DropCachedSystemFolders(UUID userID) | ||
141 | { | ||
142 | // Drop system folders | ||
143 | lock (m_InventoryCache) | ||
144 | if (m_InventoryCache.ContainsKey(userID)) | ||
145 | m_InventoryCache.Remove(userID); | ||
146 | } | ||
128 | 147 | ||
129 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | 148 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) |
130 | { | 149 | { |
131 | Dictionary<AssetType, InventoryFolderBase> folders = null; | 150 | Dictionary<AssetType, InventoryFolderBase> folders = null; |
151 | |||
132 | lock (m_InventoryCache) | 152 | lock (m_InventoryCache) |
133 | { | 153 | { |
134 | m_InventoryCache.TryGetValue(userID, out folders); | 154 | m_InventoryCache.TryGetValue(userID, out folders); |
135 | } | 155 | } |
156 | |||
136 | if ((folders != null) && folders.ContainsKey(type)) | 157 | if ((folders != null) && folders.ContainsKey(type)) |
137 | { | 158 | { |
138 | return folders[type]; | 159 | return folders[type]; |