corrected response when a not existing folder is requested by a viewer in that case the response has to report it as bad_folders with uuid instead of returning some dummy

Signed-off-by: BlueWall <jamesh@bluewallgroup.com>
inv-download
Freaky Tech 2015-03-02 22:31:17 +01:00 committed by BlueWall
parent c6731c73fb
commit bf96f06d1e
1 changed files with 28 additions and 9 deletions

View File

@ -92,6 +92,7 @@ namespace OpenSim.Capabilities.Handlers
ArrayList foldersrequested = (ArrayList)hash["folders"]; ArrayList foldersrequested = (ArrayList)hash["folders"];
string response = ""; string response = "";
string bad_folders_response = "";
for (int i = 0; i < foldersrequested.Count; i++) for (int i = 0; i < foldersrequested.Count; i++)
{ {
@ -110,25 +111,43 @@ namespace OpenSim.Capabilities.Handlers
} }
LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest); LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest);
if (null == reply)
{
bad_folders_response += "<uuid>" + llsdRequest.folder_id.ToString() + "</uuid>";
}
else
{
inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply); inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply);
inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", "");
inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", "");
}
response += inventoryitemstr; response += inventoryitemstr;
} }
if (response.Length == 0) if (response.Length == 0)
{ {
// Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. /* Viewers expect a bad_folders array when not available */
// Therefore, I'm concluding that the client only has so many threads available to do requests if (bad_folders_response.Length != 0)
// and when a thread stalls.. is stays stalled. {
// Therefore we need to return something valid response = "<llsd><map><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>";
}
else
{
response = "<llsd><map><key>folders</key><array /></map></llsd>"; response = "<llsd><map><key>folders</key><array /></map></llsd>";
} }
}
else
{
if (bad_folders_response.Length != 0)
{
response = "<llsd><map><key>folders</key><array>" + response + "</array><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>";
}
else else
{ {
response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>"; response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
} }
}
// 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");
//m_log.Debug("[WEB FETCH INV DESC HANDLER] "+response); //m_log.Debug("[WEB FETCH INV DESC HANDLER] "+response);