From 42e428427700663a9eef179e27bb02b6dd9abb16 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Fri, 4 Apr 2008 08:07:49 +0000 Subject: [PATCH] * Fixes CAPS InventoryDescendants and the notorious 'LLSDParseException:expected ' error. * Objects folder still exhibits strange behavior. --- .../Communications/Capabilities/Caps.cs | 55 ++++++++++++++++--- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 6e78452364..dadafa3fbe 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -197,16 +197,53 @@ namespace OpenSim.Region.Capabilities public string FetchInventoryRequest(string request, string path, string param) { - request = request.Replace("folders", ""); - request = request.Replace("\n", ""); - request = request.Replace("", ""); + string unmodifiedRequest = request.ToString(); + + + Hashtable hash = new Hashtable(); + try + { + + hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); + } + catch (LLSD.LLSDParseException pe) + { + m_log.Error("[INVENTORY]: Fetch error: " + pe.Message); + m_log.Error("Request:" + request.ToString()); + m_log.Error("OriginalRequest:" + unmodifiedRequest.ToString()); + } + //LLSDArray llsdFolderRequest = LLSDHelpers. + ArrayList foldersrequested = (ArrayList)hash["folders"]; + + string response = ""; + + for (int i = 0; i < foldersrequested.Count; i++) + { + string inventoryitemstr = ""; + Hashtable inventoryhash = (Hashtable)foldersrequested[i]; + + LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); + LLSDHelpers.DeserialiseLLSDMap(inventoryhash, llsdRequest); + LLSDInventoryDescendents reply = FetchInventory(llsdRequest); + + inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply); + inventoryitemstr = inventoryitemstr.Replace("folders", ""); + inventoryitemstr = inventoryitemstr.Replace("", ""); + response += inventoryitemstr; + } + if (response.Length == 0) + { + // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. + // Therefore, I'm concluding that the client only has so many threads available to do requests + // and when a thread stalls.. is stays stalled. + // Therefore we need to return something valid + response = "folders"; + } + else + { + response = "folders" + response + ""; + } - //Console.WriteLine("inventory request " + request); - Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); - LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); - LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); - LLSDInventoryDescendents reply = FetchInventory(llsdRequest); - string response = LLSDHelpers.SerialiseLLSDReply(reply); return response; }