cleanup a bit more

httptests
UbitUmarov 2018-01-24 11:43:42 +00:00
parent fc224b444a
commit 22666ad18a
1 changed files with 49 additions and 59 deletions

View File

@ -98,11 +98,11 @@ namespace OpenSim.Capabilities.Handlers
folders.Add(llsdRequest);
}
StringBuilder lastresponse = new StringBuilder(1024);
lastresponse.Append("<llsd>");
if (folders.Count > 0)
{
if(folders.Count == 0)
return "<llsd><map><key>folders</key><array /></map></llsd>";
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);
@ -114,6 +114,9 @@ namespace OpenSim.Capabilities.Handlers
#pragma warning restore 0612
}
StringBuilder lastresponse = new StringBuilder(1024);
lastresponse.Append("<llsd>");
if(invcollSet.Count > 0)
{
lastresponse.Append("<map><key>folders</key><array>");
@ -140,11 +143,6 @@ namespace OpenSim.Capabilities.Handlers
lastresponse.Append("</array></map>");
}
lastresponse.Append("</llsd>");
}
else
{
lastresponse.Append("<map><key>folders</key><array /></map></llsd>");
}
return lastresponse.ToString();;
}
@ -436,9 +434,6 @@ namespace OpenSim.Capabilities.Handlers
// FIXME MAYBE: We're not handling sortOrder!
List<InventoryCollectionWithDescendents> result = new List<InventoryCollectionWithDescendents>();
if(fetchFolders.Count <= 0)
return result;
List<LLSDFetchInventoryDescendents> libFolders = new List<LLSDFetchInventoryDescendents>();
List<LLSDFetchInventoryDescendents> otherFolders = new List<LLSDFetchInventoryDescendents>();
HashSet<UUID> libIDs = new HashSet<UUID>();
@ -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<UUID> 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)
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);
return true;
}
contents.FolderID = containingFolder.ID;
contents.OwnerID = containingFolder.Owner;
contents.Version = containingFolder.Version;
}
else
{
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 bad;
return false;
}
private void ProcessLinks(LLSDFetchInventoryDescendents freq, InventoryCollectionWithDescendents coll)