From 6c62985fd524cf502f8468b4aa303e558aff3b1c Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Sun, 4 May 2008 01:04:49 +0000
Subject: * Refactor: Do the root case removal thing again, this time in
ItemReceive()
---
.../Communications/Cache/CachedUserInfo.cs | 47 ++++++----------------
1 file changed, 13 insertions(+), 34 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 18bd994..03ba1db 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -258,7 +258,7 @@ namespace OpenSim.Framework.Communications.Cache
///
/// Callback invoked when an item is received from an async request to the inventory service.
///
- /// We're assuming here that items are always received after all the folders have been
+ /// We're assuming here that items are always received after all the folders
/// received.
///
///
@@ -267,41 +267,20 @@ namespace OpenSim.Framework.Communications.Cache
// m_log.DebugFormat(
// "[INVENTORY CACHE]: Received item {0} {1} for user {2}",
// itemInfo.Name, itemInfo.ID, userID);
+ InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder);
- if (RootFolder != null)
+ if (null == folder)
{
- if (itemInfo.Folder == RootFolder.ID)
- {
- lock (RootFolder.Items)
- {
- if (!RootFolder.Items.ContainsKey(itemInfo.ID))
- {
- RootFolder.Items.Add(itemInfo.ID, itemInfo);
- }
- else
- {
- RootFolder.Items[itemInfo.ID] = itemInfo;
- }
- }
- }
- else
- {
- InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder);
- if (folder != null)
- {
- lock (folder.Items)
- {
- if (!folder.Items.ContainsKey(itemInfo.ID))
- {
- folder.Items.Add(itemInfo.ID, itemInfo);
- }
- else
- {
- folder.Items[itemInfo.ID] = itemInfo;
- }
- }
- }
- }
+ m_log.WarnFormat(
+ "Received item {0} {1} but its folder {2} does not exist",
+ itemInfo.Name, itemInfo.ID, itemInfo.Folder);
+
+ return;
+ }
+
+ lock (folder.Items)
+ {
+ folder.Items[itemInfo.ID] = itemInfo;
}
}
--
cgit v1.1