Thank you, cmickeyb, for a patch that prevents the loss of folders received
out of sequence, and the items within.
0.6.0-stable
Melanie Thielker 2008-08-27 00:40:36 +00:00
parent 8462c8c497
commit 670719cb76
2 changed files with 29 additions and 10 deletions

View File

@ -150,6 +150,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
/// <summary> /// <summary>
/// Add any pending folders which were received before the given folder /// Add any pending folders which were received before the given folder
/// </summary> /// </summary>
@ -160,20 +161,24 @@ namespace OpenSim.Framework.Communications.Cache
{ {
if (pendingCategorizationFolders.ContainsKey(newFolder.ID)) if (pendingCategorizationFolders.ContainsKey(newFolder.ID))
{ {
List<InventoryFolderImpl> resolvedFolders = new List<InventoryFolderImpl>(); // Folders we've resolved with this invocation
foreach (InventoryFolderImpl folder in pendingCategorizationFolders[newFolder.ID]) foreach (InventoryFolderImpl folder in pendingCategorizationFolders[newFolder.ID])
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[INVENTORY CACHE]: Resolving pending received folder {0} {1} into {2} {3}", // "[INVENTORY CACHE]: Resolving pending received folder {0} {1} into {2} {3}",
// folder.name, folder.folderID, parent.name, parent.folderID); // folder.name, folder.folderID, parent.name, parent.folderID);
lock (newFolder.SubFolders) lock (newFolder.SubFolders)
{ {
if (!newFolder.SubFolders.ContainsKey(folder.ID)) if (!newFolder.SubFolders.ContainsKey(folder.ID))
{ {
resolvedFolders.Add(folder);
newFolder.SubFolders.Add(folder.ID, folder); newFolder.SubFolders.Add(folder.ID, folder);
} }
} }
} }
pendingCategorizationFolders.Remove(newFolder.ID);
foreach (InventoryFolderImpl folder in resolvedFolders)
ResolvePendingFolders(folder);
} }
} }
@ -201,13 +206,19 @@ namespace OpenSim.Framework.Communications.Cache
{ {
// FIXME: Exceptions thrown upwards never appear on the console. Could fix further up if these // FIXME: Exceptions thrown upwards never appear on the console. Could fix further up if these
// are simply being swallowed // are simply being swallowed
try try
{ {
foreach (InventoryFolderImpl folder in folders) foreach (InventoryFolderImpl folder in folders)
{ {
FolderReceive(folder); FolderReceive(folder);
} }
// Generate a warning for folders that are not part of the heirarchy
foreach ( KeyValuePair<LLUUID, IList<InventoryFolderImpl>> folderList in pendingCategorizationFolders)
{
foreach (InventoryFolderImpl folder in folderList.Value)
m_log.WarnFormat("[INVENTORY CACHE]: Malformed Database: Unresolved Pending Folder {0}", folder.Name);
}
foreach (InventoryItemBase item in items) foreach (InventoryItemBase item in items)
{ {
ItemReceive(item); ItemReceive(item);
@ -258,7 +269,11 @@ namespace OpenSim.Framework.Communications.Cache
{ {
InventoryFolderImpl parentFolder = RootFolder.FindFolder(newFolder.ParentID); InventoryFolderImpl parentFolder = RootFolder.FindFolder(newFolder.ParentID);
if (parentFolder != null) if (parentFolder == null)
{
AddPendingFolder(newFolder);
}
else
{ {
lock (parentFolder.SubFolders) lock (parentFolder.SubFolders)
{ {
@ -274,12 +289,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
} }
else
{
AddPendingFolder(newFolder);
} }
}
ResolvePendingFolders(newFolder); ResolvePendingFolders(newFolder);
} }
@ -295,7 +305,10 @@ 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); InventoryFolderImpl folder = null;
if ( RootFolder != null )
folder = RootFolder.FindFolder(itemInfo.Folder);
if (null == folder) if (null == folder)
{ {

View File

@ -440,7 +440,13 @@ namespace OpenSim.Framework.Communications.Cache
{ {
if (userProfile.HasReceivedInventory) if (userProfile.HasReceivedInventory)
{ {
InventoryItemBase item = userProfile.RootFolder.FindItem(itemID); InventoryItemBase item = null;
if ( userProfile.RootFolder == null )
m_log.ErrorFormat(
"[AGENT INVENTORY]: User {0} {1} does not have a root folder.",
remoteClient.Name, remoteClient.AgentId);
else
item = userProfile.RootFolder.FindItem(itemID);
if (item != null) if (item != null)
{ {
remoteClient.SendInventoryItemDetails(ownerID, item); remoteClient.SendInventoryItemDetails(ownerID, item);