From 3110b1661f04a501cb6a9b8173bed516211a5827 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 8 May 2015 08:37:31 -0700 Subject: [PATCH] Apparently Firestorm sometimes sends duplicate folder ids on the same request (see http://opensimulator.org/mantis/view.php?id=7054#c28297). This was throwing the new inventory download code off. Firestorm also sends requests for folder UUID.Zero, which doesn't exist, but doesn't cause any problems either -- it just fails. I'm leaving the warning message for now, just to keep an eye on which folders can't be found, but may remove it in the future. --- .../FetchInventoryDescendents/FetchInvDescHandler.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenSim/Capabilities/Handlers/FetchInventoryDescendents/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventoryDescendents/FetchInvDescHandler.cs index e4ce1f3426..27666f74b1 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventoryDescendents/FetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventoryDescendents/FetchInvDescHandler.cs @@ -109,7 +109,9 @@ namespace OpenSim.Capabilities.Handlers continue; } - folders.Add(llsdRequest); + // Filter duplicate folder ids that bad viewers may send + if (folders.Find(f => f.folder_id == llsdRequest.folder_id) == null) + folders.Add(llsdRequest); } if (folders.Count > 0) @@ -540,6 +542,8 @@ namespace OpenSim.Capabilities.Handlers List libfolders = fetchFolders.FindAll(f => f.owner_id == m_LibraryService.LibraryRootFolder.Owner); fetchFolders.RemoveAll(f => libfolders.Contains(f)); + //m_log.DebugFormat("[XXX]: Found {0} library folders in request", libfolders.Count); + foreach (LLSDFetchInventoryDescendents f in libfolders) { if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(f.folder_id)) != null) @@ -553,7 +557,7 @@ namespace OpenSim.Capabilities.Handlers ret.Collection.Version = fold.Version; ret.Descendents = ret.Collection.Items.Count; - +// m_log.DebugFormat("[XXX]: Added libfolder {0} ({1})", ret.Collection.FolderID, ret.Collection.OwnerID); result.Add(ret); } } @@ -578,6 +582,8 @@ namespace OpenSim.Capabilities.Handlers foreach (LLSDFetchInventoryDescendents f in fetchFolders) fids[i++] = f.folder_id; + //m_log.DebugFormat("[XXX]: {0}", string.Join(",", fids)); + InventoryCollection[] fetchedContents = m_InventoryService.GetMultipleFoldersContent(fetchFolders[0].owner_id, fids); if (fetchedContents == null || (fetchedContents != null && fetchedContents.Length == 0))