diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs | 47 |
1 files changed, 34 insertions, 13 deletions
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]; |