diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
index 89d9e80794..bc925362f9 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
@@ -98,53 +98,51 @@ namespace OpenSim.Capabilities.Handlers
folders.Add(llsdRequest);
}
+ if(folders.Count == 0)
+ return "";
+
+ 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.");
+#pragma warning disable 0612
+ return FetchInventoryDescendentsRequest(foldersrequested, httpRequest, httpResponse);
+#pragma warning restore 0612
+ }
+
StringBuilder lastresponse = new StringBuilder(1024);
lastresponse.Append("");
- if (folders.Count > 0)
+
+ if(invcollSet.Count > 0)
{
- 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)
+ lastresponse.Append("");
+ lastresponse.Append("");
}
else
+ lastresponse.Append("folders");
+
+ //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders));
+ if(bad_folders.Count > 0)
{
- lastresponse.Append("folders");
+ lastresponse.Append("bad_folders");
+ foreach (UUID bad in bad_folders)
+ {
+ lastresponse.Append("folder_id");
+ lastresponse.Append(bad.ToString());
+ lastresponse.Append("errorUnknown");
+ }
+ lastresponse.Append("");
}
+ lastresponse.Append("");
return lastresponse.ToString();;
}
@@ -436,9 +434,6 @@ namespace OpenSim.Capabilities.Handlers
// FIXME MAYBE: We're not handling sortOrder!
List result = new List();
- if(fetchFolders.Count <= 0)
- return result;
-
List libFolders = new List();
List otherFolders = new List();
HashSet libIDs = new HashSet();
@@ -452,10 +447,14 @@ namespace OpenSim.Capabilities.Handlers
// Filter folder Zero right here. Some viewers (Firestorm) send request for folder Zero, which doesn't make sense
// and can kill the sim (all root folders have parent_id Zero)
// send something.
+ bool doneZeroID = false;
foreach(LLSDFetchInventoryDescendents f in fetchFolders)
{
if (f.folder_id == UUID.Zero)
{
+ if(doneZeroID)
+ continue;
+ doneZeroID = true;
InventoryCollectionWithDescendents zeroColl = new InventoryCollectionWithDescendents();
zeroColl.Collection = new InventoryCollection();
zeroColl.Collection.OwnerID = f.owner_id;
@@ -479,17 +478,13 @@ namespace OpenSim.Capabilities.Handlers
otherFolders.Add(f);
}
-
if(otherFolders.Count > 0)
{
- UUID[] fids = new UUID[otherFolders.Count];
int i = 0;
- foreach (LLSDFetchInventoryDescendents f in otherFolders)
- fids[i++] = f.folder_id;
//m_log.DebugFormat("[XXX]: {0}", string.Join(",", fids));
- InventoryCollection[] fetchedContents = m_InventoryService.GetMultipleFoldersContent(otherFolders[0].owner_id, fids);
+ InventoryCollection[] fetchedContents = m_InventoryService.GetMultipleFoldersContent(otherFolders[0].owner_id, otherIDs.ToArray());
if (fetchedContents == null)
return null;
@@ -532,34 +527,29 @@ namespace OpenSim.Capabilities.Handlers
private bool BadFolder(LLSDFetchInventoryDescendents freq, InventoryCollection contents, List bad_folders)
{
- bool bad = false;
if (contents == null)
{
bad_folders.Add(freq.folder_id);
- bad = true;
+ return true;
}
// The inventory server isn't sending FolderID in the collection...
// Must fetch it individually
- else if (contents.FolderID == UUID.Zero)
+ if (contents.FolderID == UUID.Zero)
{
InventoryFolderBase containingFolder = m_InventoryService.GetFolder(freq.owner_id, freq.folder_id);
-
- if (containingFolder != null)
- {
- contents.FolderID = containingFolder.ID;
- contents.OwnerID = containingFolder.Owner;
- contents.Version = containingFolder.Version;
- }
- else
+ if (containingFolder == null)
{
m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Unable to fetch folder {0}", freq.folder_id);
bad_folders.Add(freq.folder_id);
- bad = true;
+ return true;
}
+ contents.FolderID = containingFolder.ID;
+ contents.OwnerID = containingFolder.Owner;
+ contents.Version = containingFolder.Version;
}
- return bad;
+ return false;
}
private void ProcessLinks(LLSDFetchInventoryDescendents freq, InventoryCollectionWithDescendents coll)