aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2016-07-17 22:52:58 +0100
committerUbitUmarov2016-07-17 22:52:58 +0100
commiteaefae7e20c95266ad84ea59912cf8c011ccd1b5 (patch)
tree29a8d483e9fdbcad69e1535f89e7abcf838ea136 /OpenSim
parentdont try dequeues if didnt reacquired lock (diff)
downloadopensim-SC-eaefae7e20c95266ad84ea59912cf8c011ccd1b5.zip
opensim-SC-eaefae7e20c95266ad84ea59912cf8c011ccd1b5.tar.gz
opensim-SC-eaefae7e20c95266ad84ea59912cf8c011ccd1b5.tar.bz2
opensim-SC-eaefae7e20c95266ad84ea59912cf8c011ccd1b5.tar.xz
don't loose inventory items when there are bad folders
Diffstat (limited to '')
-rw-r--r--OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs98
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs12
2 files changed, 49 insertions, 61 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
index e3a9a22..45eda57 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
@@ -30,6 +30,7 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Linq; 31using System.Linq;
32using System.Reflection; 32using System.Reflection;
33using System.Text;
33using log4net; 34using log4net;
34using Nini.Config; 35using Nini.Config;
35using OpenMetaverse; 36using OpenMetaverse;
@@ -93,8 +94,8 @@ namespace OpenSim.Capabilities.Handlers
93 94
94 ArrayList foldersrequested = (ArrayList)hash["folders"]; 95 ArrayList foldersrequested = (ArrayList)hash["folders"];
95 96
96 string response = ""; 97 StringBuilder tmpresponse = new StringBuilder(1024);
97 string bad_folders_response = ""; 98 StringBuilder tmpbadfolders = new StringBuilder(1024);
98 99
99 List<LLSDFetchInventoryDescendents> folders = new List<LLSDFetchInventoryDescendents>(); 100 List<LLSDFetchInventoryDescendents> folders = new List<LLSDFetchInventoryDescendents>();
100 for (int i = 0; i < foldersrequested.Count; i++) 101 for (int i = 0; i < foldersrequested.Count; i++)
@@ -142,43 +143,38 @@ namespace OpenSim.Capabilities.Handlers
142 inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); 143 inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", "");
143 inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); 144 inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", "");
144 145
145 response += inventoryitemstr; 146 tmpresponse.Append(inventoryitemstr);
146 } 147 }
147 148
148 //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders)); 149 //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders));
149 foreach (UUID bad in bad_folders) 150 foreach (UUID bad in bad_folders)
150 bad_folders_response += "<uuid>" + bad + "</uuid>"; 151 {
152 tmpbadfolders.Append("<map><key>folder_id</key><uuid>");
153 tmpbadfolders.Append(bad.ToString());
154 tmpbadfolders.Append("</uuid><key>error</key><string>Unknown</string></map>");
155 }
151 } 156 }
152 157
153 if (response.Length == 0) 158 StringBuilder lastresponse = new StringBuilder(1024);
159 lastresponse.Append("<llsd>");
160 if(tmpresponse.Length > 0)
154 { 161 {
155 /* Viewers expect a bad_folders array when not available */ 162 lastresponse.Append("<map><key>folders</key><array>");
156 if (bad_folders_response.Length != 0) 163 lastresponse.Append(tmpresponse.ToString());
157 { 164 lastresponse.Append("</array></map>");
158 response = "<llsd><map><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>";
159 }
160 else
161 {
162 response = "<llsd><map><key>folders</key><array /></map></llsd>";
163 }
164 } 165 }
165 else 166 else
167 lastresponse.Append("<map><key>folders</key><array /></map>");
168
169 if(tmpbadfolders.Length > 0)
166 { 170 {
167 if (bad_folders_response.Length != 0) 171 lastresponse.Append("<map><key>bad_folders</key><array>");
168 { 172 lastresponse.Append(tmpbadfolders.ToString());
169 response = "<llsd><map><key>folders</key><array>" + response + "</array><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>"; 173 lastresponse.Append("</array></map>");
170 }
171 else
172 {
173 response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
174 }
175 } 174 }
175 lastresponse.Append("</llsd>");
176 176
177 //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request for {0} folders. Item count {1}", folders.Count, item_count); 177 return lastresponse.ToString();
178 //m_log.Debug("[WEB FETCH INV DESC HANDLER] " + response);
179
180 return response;
181
182 } 178 }
183 179
184 /// <summary> 180 /// <summary>
@@ -285,8 +281,8 @@ namespace OpenSim.Capabilities.Handlers
285 { 281 {
286 //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request for {0} folders", foldersrequested.Count); 282 //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request for {0} folders", foldersrequested.Count);
287 283
288 string response = ""; 284 StringBuilder tmpresponse = new StringBuilder(1024);
289 string bad_folders_response = ""; 285 StringBuilder tmpbadfolders = new StringBuilder(1024);
290 286
291 for (int i = 0; i < foldersrequested.Count; i++) 287 for (int i = 0; i < foldersrequested.Count; i++)
292 { 288 {
@@ -308,7 +304,9 @@ namespace OpenSim.Capabilities.Handlers
308 304
309 if (null == reply) 305 if (null == reply)
310 { 306 {
311 bad_folders_response += "<uuid>" + llsdRequest.folder_id.ToString() + "</uuid>"; 307 tmpbadfolders.Append("<map><key>folder_id</key><uuid>");
308 tmpbadfolders.Append(llsdRequest.folder_id.ToString());
309 tmpbadfolders.Append("</uuid><key>error</key><string>Unknown</string></map>");
312 } 310 }
313 else 311 else
314 { 312 {
@@ -317,39 +315,29 @@ namespace OpenSim.Capabilities.Handlers
317 inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); 315 inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", "");
318 } 316 }
319 317
320 response += inventoryitemstr; 318 tmpresponse.Append(inventoryitemstr);
321 } 319 }
322 320
323 if (response.Length == 0) 321 StringBuilder lastresponse = new StringBuilder(1024);
322 lastresponse.Append("<llsd>");
323 if(tmpresponse.Length > 0)
324 { 324 {
325 /* Viewers expect a bad_folders array when not available */ 325 lastresponse.Append("<map><key>folders</key><array>");
326 if (bad_folders_response.Length != 0) 326 lastresponse.Append(tmpresponse.ToString());
327 { 327 lastresponse.Append("</array></map>");
328 response = "<llsd><map><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>";
329 }
330 else
331 {
332 response = "<llsd><map><key>folders</key><array /></map></llsd>";
333 }
334 } 328 }
335 else 329 else
330 lastresponse.Append("<map><key>folders</key><array /></map>");
331
332 if(tmpbadfolders.Length > 0)
336 { 333 {
337 if (bad_folders_response.Length != 0) 334 lastresponse.Append("<map><key>bad_folders</key><array>");
338 { 335 lastresponse.Append(tmpbadfolders.ToString());
339 response = "<llsd><map><key>folders</key><array>" + response + "</array><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>"; 336 lastresponse.Append("</array></map>");
340 }
341 else
342 {
343 response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
344 }
345 } 337 }
338 lastresponse.Append("</llsd>");
346 339
347 // m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request"); 340 return lastresponse.ToString();
348 //m_log.Debug("[WEB FETCH INV DESC HANDLER] "+response);
349
350 return response;
351
352 // }
353 } 341 }
354 342
355 /// <summary> 343 /// <summary>
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index ed5b3dd..0277a24 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -61,7 +61,6 @@ namespace OpenSim.Region.ClientStack.Linden
61 public UUID reqID; 61 public UUID reqID;
62 public Hashtable request; 62 public Hashtable request;
63 public ScenePresence presence; 63 public ScenePresence presence;
64 public List<UUID> folders;
65 } 64 }
66 65
67 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 66 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -296,8 +295,10 @@ namespace OpenSim.Region.ClientStack.Linden
296 reqinfo.reqID = x; 295 reqinfo.reqID = x;
297 reqinfo.request = y; 296 reqinfo.request = y;
298 reqinfo.presence = sp; 297 reqinfo.presence = sp;
299 reqinfo.folders = new List<UUID>();
300 298
299/* why where we doing this? just to get cof ?
300 List<UUID> folders = new List<UUID>();
301
301 // Decode the request here 302 // Decode the request here
302 string request = y["body"].ToString(); 303 string request = y["body"].ToString();
303 304
@@ -333,11 +334,11 @@ namespace OpenSim.Region.ClientStack.Linden
333 UUID folderID; 334 UUID folderID;
334 if (UUID.TryParse(folder, out folderID)) 335 if (UUID.TryParse(folder, out folderID))
335 { 336 {
336 if (!reqinfo.folders.Contains(folderID)) 337 if (!folders.Contains(folderID))
337 { 338 {
338 if (sp.COF != UUID.Zero && sp.COF == folderID) 339 if (sp.COF != UUID.Zero && sp.COF == folderID)
339 highPriority = true; 340 highPriority = true;
340 reqinfo.folders.Add(folderID); 341 folders.Add(folderID);
341 } 342 }
342 } 343 }
343 } 344 }
@@ -345,6 +346,7 @@ namespace OpenSim.Region.ClientStack.Linden
345 if (highPriority) 346 if (highPriority)
346 m_queue.PriorityEnqueue(reqinfo); 347 m_queue.PriorityEnqueue(reqinfo);
347 else 348 else
349*/
348 m_queue.Enqueue(reqinfo); 350 m_queue.Enqueue(reqinfo);
349 }; 351 };
350 352
@@ -406,7 +408,6 @@ namespace OpenSim.Region.ClientStack.Linden
406 if(dropedResponses.Contains(requestID)) 408 if(dropedResponses.Contains(requestID))
407 { 409 {
408 dropedResponses.Remove(requestID); 410 dropedResponses.Remove(requestID);
409 requestinfo.folders.Clear();
410 requestinfo.request.Clear(); 411 requestinfo.request.Clear();
411 WebFetchInvDescModule.ProcessedRequestsCount++; 412 WebFetchInvDescModule.ProcessedRequestsCount++;
412 return; 413 return;
@@ -417,7 +418,6 @@ namespace OpenSim.Region.ClientStack.Linden
417 m_log.WarnFormat("[FETCH INVENTORY DESCENDENTS2 MODULE]: Caught in the act of loosing responses! Please report this on mantis #7054"); 418 m_log.WarnFormat("[FETCH INVENTORY DESCENDENTS2 MODULE]: Caught in the act of loosing responses! Please report this on mantis #7054");
418 responses[requestID] = response; 419 responses[requestID] = response;
419 } 420 }
420 requestinfo.folders.Clear();
421 requestinfo.request.Clear(); 421 requestinfo.request.Clear();
422 WebFetchInvDescModule.ProcessedRequestsCount++; 422 WebFetchInvDescModule.ProcessedRequestsCount++;
423 } 423 }