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!
fsassets
Diva Canto 2015-05-08 17:02:02 -07:00
parent 3110b1661f
commit e5cf6a29fb
1 changed files with 49 additions and 10 deletions

View File

@ -116,8 +116,10 @@ namespace OpenSim.Capabilities.Handlers
if (folders.Count > 0) if (folders.Count > 0)
{ {
List<InventoryCollectionWithDescendents> invcollSet = Fetch(folders); List<UUID> bad_folders = new List<UUID>();
List<InventoryCollectionWithDescendents> invcollSet = Fetch(folders, bad_folders);
//m_log.DebugFormat("[XXX]: Got {0} folders from a request of {1}", invcollSet.Count, folders.Count); //m_log.DebugFormat("[XXX]: Got {0} folders from a request of {1}", invcollSet.Count, folders.Count);
if (invcollSet == null) if (invcollSet == null)
{ {
m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Multiple folder fetch failed. Trying old protocol."); 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; 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 += "<uuid>" + bad + "</uuid>";
} }
if (response.Length == 0) 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.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); //m_log.Debug("[WEB FETCH INV DESC HANDLER] " + response);
return response; return response;
@ -557,14 +563,15 @@ namespace OpenSim.Capabilities.Handlers
ret.Collection.Version = fold.Version; ret.Collection.Version = fold.Version;
ret.Descendents = ret.Collection.Items.Count; ret.Descendents = ret.Collection.Items.Count;
// m_log.DebugFormat("[XXX]: Added libfolder {0} ({1})", ret.Collection.FolderID, ret.Collection.OwnerID);
result.Add(ret); result.Add(ret);
//m_log.DebugFormat("[XXX]: Added libfolder {0} ({1}) {2}", ret.Collection.FolderID, ret.Collection.OwnerID);
} }
} }
} }
} }
private List<InventoryCollectionWithDescendents> Fetch(List<LLSDFetchInventoryDescendents> fetchFolders) private List<InventoryCollectionWithDescendents> Fetch(List<LLSDFetchInventoryDescendents> fetchFolders, List<UUID> bad_folders)
{ {
//m_log.DebugFormat( //m_log.DebugFormat(
// "[WEB FETCH INV DESC HANDLER]: Fetching {0} folders for owner {1}", fetchFolders.Count, fetchFolders[0].owner_id); // "[WEB FETCH INV DESC HANDLER]: Fetching {0} folders for owner {1}", fetchFolders.Count, fetchFolders[0].owner_id);
@ -596,12 +603,16 @@ namespace OpenSim.Capabilities.Handlers
// Do some post-processing. May need to fetch more from inv server for links // Do some post-processing. May need to fetch more from inv server for links
foreach (InventoryCollection contents in fetchedContents) foreach (InventoryCollection contents in fetchedContents)
{ {
if (contents == null)
continue;
InventoryCollectionWithDescendents coll = new InventoryCollectionWithDescendents(); InventoryCollectionWithDescendents coll = new InventoryCollectionWithDescendents();
coll.Collection = contents; coll.Collection = contents;
if (contents == null)
{
bad_folders.Add(fids[i++]);
continue;
}
// Find the original request // Find the original request
LLSDFetchInventoryDescendents freq = fetchFolders[i++]; LLSDFetchInventoryDescendents freq = fetchFolders[i++];
@ -621,11 +632,39 @@ namespace OpenSim.Capabilities.Handlers
contents.Version = containingFolder.Version; contents.Version = containingFolder.Version;
} }
else else
{
// 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); m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Unable to fetch folder {0}", freq.folder_id);
bad_folders.Add(freq.folder_id);
continue; continue;
} }
} }
}
if (freq.fetch_items && contents.Items != null) if (freq.fetch_items && contents.Items != null)
{ {