aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-22 20:59:08 +0000
committerJustin Clarke Casey2008-04-22 20:59:08 +0000
commitcd29f90418b8690cffc2df8fae52fa976090e574 (patch)
tree40f892aacd0d1d81d4b3b7042530db0e7f45d215 /OpenSim/Framework/Communications/Cache
parent* Add DeleteAllContents() method to InventoryFolderImpl - not yet used but wi... (diff)
downloadopensim-SC-cd29f90418b8690cffc2df8fae52fa976090e574.zip
opensim-SC-cd29f90418b8690cffc2df8fae52fa976090e574.tar.gz
opensim-SC-cd29f90418b8690cffc2df8fae52fa976090e574.tar.bz2
opensim-SC-cd29f90418b8690cffc2df8fae52fa976090e574.tar.xz
* Add folders and items locking in external manipulations of InventoryFolderImpl carried out by CachedUserInfo
* These will do temporarily pending refactoring
Diffstat (limited to 'OpenSim/Framework/Communications/Cache')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs55
1 files changed, 35 insertions, 20 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 9a7ce42..f1268d5 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -142,10 +142,13 @@ namespace OpenSim.Framework.Communications.Cache
142// "[INVENTORY CACHE]: Resolving pending received folder {0} {1} into {2} {3}", 142// "[INVENTORY CACHE]: Resolving pending received folder {0} {1} into {2} {3}",
143// folder.name, folder.folderID, parent.name, parent.folderID); 143// folder.name, folder.folderID, parent.name, parent.folderID);
144 144
145 if (!parent.SubFolders.ContainsKey(folder.ID)) 145 lock (parent.SubFolders)
146 { 146 {
147 parent.SubFolders.Add(folder.ID, folder); 147 if (!parent.SubFolders.ContainsKey(folder.ID))
148 } 148 {
149 parent.SubFolders.Add(folder.ID, folder);
150 }
151 }
149 } 152 }
150 } 153 }
151 } 154 }
@@ -212,28 +215,34 @@ namespace OpenSim.Framework.Communications.Cache
212 } 215 }
213 else if (RootFolder.ID == folderInfo.ParentID) 216 else if (RootFolder.ID == folderInfo.ParentID)
214 { 217 {
215 if (!RootFolder.SubFolders.ContainsKey(folderInfo.ID)) 218 lock (RootFolder.SubFolders)
216 { 219 {
217 RootFolder.SubFolders.Add(folderInfo.ID, folderInfo); 220 if (!RootFolder.SubFolders.ContainsKey(folderInfo.ID))
221 {
222 RootFolder.SubFolders.Add(folderInfo.ID, folderInfo);
223 }
224 else
225 {
226 AddPendingFolder(folderInfo);
227 }
218 } 228 }
219 else
220 {
221 AddPendingFolder(folderInfo);
222 }
223 } 229 }
224 else 230 else
225 { 231 {
226 InventoryFolderImpl folder = RootFolder.HasSubFolder(folderInfo.ParentID); 232 InventoryFolderImpl folder = RootFolder.HasSubFolder(folderInfo.ParentID);
227 if (folder != null) 233 lock (folder.SubFolders)
228 { 234 {
229 if (!folder.SubFolders.ContainsKey(folderInfo.ID)) 235 if (folder != null)
230 { 236 {
231 folder.SubFolders.Add(folderInfo.ID, folderInfo); 237 if (!folder.SubFolders.ContainsKey(folderInfo.ID))
238 {
239 folder.SubFolders.Add(folderInfo.ID, folderInfo);
240 }
241 }
242 else
243 {
244 AddPendingFolder(folderInfo);
232 } 245 }
233 }
234 else
235 {
236 AddPendingFolder(folderInfo);
237 } 246 }
238 } 247 }
239 248
@@ -259,9 +268,12 @@ namespace OpenSim.Framework.Communications.Cache
259 { 268 {
260 if (itemInfo.Folder == RootFolder.ID) 269 if (itemInfo.Folder == RootFolder.ID)
261 { 270 {
262 if (!RootFolder.Items.ContainsKey(itemInfo.ID)) 271 lock (RootFolder.Items)
263 { 272 {
264 RootFolder.Items.Add(itemInfo.ID, itemInfo); 273 if (!RootFolder.Items.ContainsKey(itemInfo.ID))
274 {
275 RootFolder.Items.Add(itemInfo.ID, itemInfo);
276 }
265 } 277 }
266 } 278 }
267 else 279 else
@@ -269,9 +281,12 @@ namespace OpenSim.Framework.Communications.Cache
269 InventoryFolderImpl folder = RootFolder.HasSubFolder(itemInfo.Folder); 281 InventoryFolderImpl folder = RootFolder.HasSubFolder(itemInfo.Folder);
270 if (folder != null) 282 if (folder != null)
271 { 283 {
272 if (!folder.Items.ContainsKey(itemInfo.ID)) 284 lock (folder.Items)
273 { 285 {
274 folder.Items.Add(itemInfo.ID, itemInfo); 286 if (!folder.Items.ContainsKey(itemInfo.ID))
287 {
288 folder.Items.Add(itemInfo.ID, itemInfo);
289 }
275 } 290 }
276 } 291 }
277 } 292 }