aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
authorTeravus Ovares2008-04-04 08:07:49 +0000
committerTeravus Ovares2008-04-04 08:07:49 +0000
commit42e428427700663a9eef179e27bb02b6dd9abb16 (patch)
treed64a0840438ef926e11a1e7a56502e08ab69414b /OpenSim/Framework/Communications
parent* Fixing permissions on items returned via CAPS based inventory (diff)
downloadopensim-SC_OLD-42e428427700663a9eef179e27bb02b6dd9abb16.zip
opensim-SC_OLD-42e428427700663a9eef179e27bb02b6dd9abb16.tar.gz
opensim-SC_OLD-42e428427700663a9eef179e27bb02b6dd9abb16.tar.bz2
opensim-SC_OLD-42e428427700663a9eef179e27bb02b6dd9abb16.tar.xz
* Fixes CAPS InventoryDescendants and the notorious 'LLSDParseException:expected </llsd>' error.
* Objects folder still exhibits strange behavior.
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs55
1 files changed, 46 insertions, 9 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index 6e78452..dadafa3 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -197,16 +197,53 @@ namespace OpenSim.Region.Capabilities
197 197
198 public string FetchInventoryRequest(string request, string path, string param) 198 public string FetchInventoryRequest(string request, string path, string param)
199 { 199 {
200 request = request.Replace("<llsd><map><key>folders</key><array>", "<llsd>"); 200 string unmodifiedRequest = request.ToString();
201 request = request.Replace("\n", ""); 201
202 request = request.Replace("</map></array></map>", "</map>"); 202
203 Hashtable hash = new Hashtable();
204 try
205 {
206
207 hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request));
208 }
209 catch (LLSD.LLSDParseException pe)
210 {
211 m_log.Error("[INVENTORY]: Fetch error: " + pe.Message);
212 m_log.Error("Request:" + request.ToString());
213 m_log.Error("OriginalRequest:" + unmodifiedRequest.ToString());
214 }
215 //LLSDArray llsdFolderRequest = LLSDHelpers.
216 ArrayList foldersrequested = (ArrayList)hash["folders"];
217
218 string response = "";
219
220 for (int i = 0; i < foldersrequested.Count; i++)
221 {
222 string inventoryitemstr = "";
223 Hashtable inventoryhash = (Hashtable)foldersrequested[i];
224
225 LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents();
226 LLSDHelpers.DeserialiseLLSDMap(inventoryhash, llsdRequest);
227 LLSDInventoryDescendents reply = FetchInventory(llsdRequest);
228
229 inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply);
230 inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", "");
231 inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", "");
232 response += inventoryitemstr;
233 }
234 if (response.Length == 0)
235 {
236 // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants.
237 // Therefore, I'm concluding that the client only has so many threads available to do requests
238 // and when a thread stalls.. is stays stalled.
239 // Therefore we need to return something valid
240 response = "<llsd><map><key>folders</key><array /></map></llsd>";
241 }
242 else
243 {
244 response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
245 }
203 246
204 //Console.WriteLine("inventory request " + request);
205 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request));
206 LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents();
207 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
208 LLSDInventoryDescendents reply = FetchInventory(llsdRequest);
209 string response = LLSDHelpers.SerialiseLLSDReply(reply);
210 return response; 247 return response;
211 } 248 }
212 249