* Refactor: Do the root case removal thing again, this time in ItemReceive()

0.6.0-stable
Justin Clarke Casey 2008-05-04 01:04:49 +00:00
parent 9646258fdf
commit 6c62985fd5
1 changed files with 13 additions and 34 deletions

View File

@ -258,7 +258,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <summary> /// <summary>
/// Callback invoked when an item is received from an async request to the inventory service. /// 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. /// received.
/// </summary> /// </summary>
/// <param name="folderInfo"></param> /// <param name="folderInfo"></param>
@ -267,41 +267,20 @@ namespace OpenSim.Framework.Communications.Cache
// m_log.DebugFormat( // m_log.DebugFormat(
// "[INVENTORY CACHE]: Received item {0} {1} for user {2}", // "[INVENTORY CACHE]: Received item {0} {1} for user {2}",
// itemInfo.Name, itemInfo.ID, userID); // itemInfo.Name, itemInfo.ID, userID);
InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder);
if (RootFolder != null) if (null == folder)
{ {
if (itemInfo.Folder == RootFolder.ID) m_log.WarnFormat(
{ "Received item {0} {1} but its folder {2} does not exist",
lock (RootFolder.Items) itemInfo.Name, itemInfo.ID, itemInfo.Folder);
{
if (!RootFolder.Items.ContainsKey(itemInfo.ID)) return;
{ }
RootFolder.Items.Add(itemInfo.ID, itemInfo);
} lock (folder.Items)
else {
{ folder.Items[itemInfo.ID] = itemInfo;
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;
}
}
}
}
} }
} }