From e5cf6a29fba650ef163f325c919417c35855aa2b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 8 May 2015 17:02:02 -0700 Subject: Restore handling of bad folders. I'm not entirely sure this is part of the protocol -- I don't see it here: http://wiki.secondlife.com/wiki/Linden_Lab_Official:Inventory_API#Fetch_inventory_descendents But who knows! --- .../FetchInvDescHandler.cs | 57 ++++++++++++++++++---- 1 file changed, 48 insertions(+), 9 deletions(-) (limited to 'OpenSim/Capabilities') diff --git a/OpenSim/Capabilities/Handlers/FetchInventoryDescendents/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventoryDescendents/FetchInvDescHandler.cs index 27666f7..b7f332d 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventoryDescendents/FetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventoryDescendents/FetchInvDescHandler.cs @@ -116,8 +116,10 @@ namespace OpenSim.Capabilities.Handlers if (folders.Count > 0) { - List invcollSet = Fetch(folders); + List bad_folders = new List(); + List invcollSet = Fetch(folders, bad_folders); //m_log.DebugFormat("[XXX]: Got {0} folders from a request of {1}", invcollSet.Count, folders.Count); + if (invcollSet == null) { m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Multiple folder fetch failed. Trying old protocol."); @@ -135,6 +137,10 @@ namespace OpenSim.Capabilities.Handlers response += inventoryitemstr; } + + //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders)); + foreach (UUID bad in bad_folders) + bad_folders_response += "" + bad + ""; } if (response.Length == 0) @@ -161,8 +167,8 @@ namespace OpenSim.Capabilities.Handlers } } -// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request"); -// m_log.Debug("[WEB FETCH INV DESC HANDLER] "+response); + //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request for {0} folders. Item count {1}", folders.Count, item_count); + //m_log.Debug("[WEB FETCH INV DESC HANDLER] " + response); return response; @@ -557,14 +563,15 @@ 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); + + //m_log.DebugFormat("[XXX]: Added libfolder {0} ({1}) {2}", ret.Collection.FolderID, ret.Collection.OwnerID); } } } } - private List Fetch(List fetchFolders) + private List Fetch(List fetchFolders, List bad_folders) { //m_log.DebugFormat( // "[WEB FETCH INV DESC HANDLER]: Fetching {0} folders for owner {1}", fetchFolders.Count, fetchFolders[0].owner_id); @@ -596,11 +603,15 @@ namespace OpenSim.Capabilities.Handlers // Do some post-processing. May need to fetch more from inv server for links foreach (InventoryCollection contents in fetchedContents) { + InventoryCollectionWithDescendents coll = new InventoryCollectionWithDescendents(); + coll.Collection = contents; + if (contents == null) + { + bad_folders.Add(fids[i++]); continue; + } - InventoryCollectionWithDescendents coll = new InventoryCollectionWithDescendents(); - coll.Collection = contents; // Find the original request LLSDFetchInventoryDescendents freq = fetchFolders[i++]; @@ -622,8 +633,36 @@ namespace OpenSim.Capabilities.Handlers } else { - m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Unable to fetch folder {0}", freq.folder_id); - continue; + // Was it really a request for folder Zero? + // This is an overkill, but Firestorm really asks for folder Zero. + // I'm leaving the code here for the time being, but commented. + if (fetchFolders[i - 1].folder_id == UUID.Zero) + { + //coll.Collection.OwnerID = freq.owner_id; + //coll.Collection.FolderID = contents.FolderID; + //containingFolder = m_InventoryService.GetRootFolder(freq.owner_id); + //if (containingFolder != null) + //{ + // m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Request for parent of folder {0}", containingFolder.ID); + // coll.Collection.Folders.Clear(); + // coll.Collection.Folders.Add(containingFolder); + // if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null) + // { + // InventoryFolderBase lib = new InventoryFolderBase(m_LibraryService.LibraryRootFolder.ID, m_LibraryService.LibraryRootFolder.Owner); + // lib.Name = m_LibraryService.LibraryRootFolder.Name; + // lib.Type = m_LibraryService.LibraryRootFolder.Type; + // lib.Version = m_LibraryService.LibraryRootFolder.Version; + // coll.Collection.Folders.Add(lib); + // } + // coll.Collection.Items.Clear(); + //} + } + else + { + m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Unable to fetch folder {0}", freq.folder_id); + bad_folders.Add(freq.folder_id); + continue; + } } } -- cgit v1.1