don't loose inventory items when there are bad folders
parent
79e464f33f
commit
eaefae7e20
|
@ -30,6 +30,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
|
@ -93,8 +94,8 @@ namespace OpenSim.Capabilities.Handlers
|
|||
|
||||
ArrayList foldersrequested = (ArrayList)hash["folders"];
|
||||
|
||||
string response = "";
|
||||
string bad_folders_response = "";
|
||||
StringBuilder tmpresponse = new StringBuilder(1024);
|
||||
StringBuilder tmpbadfolders = new StringBuilder(1024);
|
||||
|
||||
List<LLSDFetchInventoryDescendents> folders = new List<LLSDFetchInventoryDescendents>();
|
||||
for (int i = 0; i < foldersrequested.Count; i++)
|
||||
|
@ -142,43 +143,38 @@ namespace OpenSim.Capabilities.Handlers
|
|||
inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", "");
|
||||
inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", "");
|
||||
|
||||
response += inventoryitemstr;
|
||||
tmpresponse.Append(inventoryitemstr);
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders));
|
||||
foreach (UUID bad in bad_folders)
|
||||
bad_folders_response += "<uuid>" + bad + "</uuid>";
|
||||
{
|
||||
tmpbadfolders.Append("<map><key>folder_id</key><uuid>");
|
||||
tmpbadfolders.Append(bad.ToString());
|
||||
tmpbadfolders.Append("</uuid><key>error</key><string>Unknown</string></map>");
|
||||
}
|
||||
}
|
||||
|
||||
if (response.Length == 0)
|
||||
StringBuilder lastresponse = new StringBuilder(1024);
|
||||
lastresponse.Append("<llsd>");
|
||||
if(tmpresponse.Length > 0)
|
||||
{
|
||||
/* Viewers expect a bad_folders array when not available */
|
||||
if (bad_folders_response.Length != 0)
|
||||
{
|
||||
response = "<llsd><map><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>";
|
||||
}
|
||||
else
|
||||
{
|
||||
response = "<llsd><map><key>folders</key><array /></map></llsd>";
|
||||
}
|
||||
lastresponse.Append("<map><key>folders</key><array>");
|
||||
lastresponse.Append(tmpresponse.ToString());
|
||||
lastresponse.Append("</array></map>");
|
||||
}
|
||||
else
|
||||
lastresponse.Append("<map><key>folders</key><array /></map>");
|
||||
|
||||
if(tmpbadfolders.Length > 0)
|
||||
{
|
||||
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
|
||||
{
|
||||
response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
|
||||
}
|
||||
lastresponse.Append("<map><key>bad_folders</key><array>");
|
||||
lastresponse.Append(tmpbadfolders.ToString());
|
||||
lastresponse.Append("</array></map>");
|
||||
}
|
||||
lastresponse.Append("</llsd>");
|
||||
|
||||
//m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request for {0} folders. Item count {1}", folders.Count, item_count);
|
||||
//m_log.Debug("[WEB FETCH INV DESC HANDLER] " + response);
|
||||
|
||||
return response;
|
||||
|
||||
return lastresponse.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -285,8 +281,8 @@ namespace OpenSim.Capabilities.Handlers
|
|||
{
|
||||
//m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request for {0} folders", foldersrequested.Count);
|
||||
|
||||
string response = "";
|
||||
string bad_folders_response = "";
|
||||
StringBuilder tmpresponse = new StringBuilder(1024);
|
||||
StringBuilder tmpbadfolders = new StringBuilder(1024);
|
||||
|
||||
for (int i = 0; i < foldersrequested.Count; i++)
|
||||
{
|
||||
|
@ -308,7 +304,9 @@ namespace OpenSim.Capabilities.Handlers
|
|||
|
||||
if (null == reply)
|
||||
{
|
||||
bad_folders_response += "<uuid>" + llsdRequest.folder_id.ToString() + "</uuid>";
|
||||
tmpbadfolders.Append("<map><key>folder_id</key><uuid>");
|
||||
tmpbadfolders.Append(llsdRequest.folder_id.ToString());
|
||||
tmpbadfolders.Append("</uuid><key>error</key><string>Unknown</string></map>");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -317,39 +315,29 @@ namespace OpenSim.Capabilities.Handlers
|
|||
inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", "");
|
||||
}
|
||||
|
||||
response += inventoryitemstr;
|
||||
tmpresponse.Append(inventoryitemstr);
|
||||
}
|
||||
|
||||
if (response.Length == 0)
|
||||
StringBuilder lastresponse = new StringBuilder(1024);
|
||||
lastresponse.Append("<llsd>");
|
||||
if(tmpresponse.Length > 0)
|
||||
{
|
||||
/* Viewers expect a bad_folders array when not available */
|
||||
if (bad_folders_response.Length != 0)
|
||||
{
|
||||
response = "<llsd><map><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>";
|
||||
}
|
||||
else
|
||||
{
|
||||
response = "<llsd><map><key>folders</key><array /></map></llsd>";
|
||||
}
|
||||
lastresponse.Append("<map><key>folders</key><array>");
|
||||
lastresponse.Append(tmpresponse.ToString());
|
||||
lastresponse.Append("</array></map>");
|
||||
}
|
||||
else
|
||||
lastresponse.Append("<map><key>folders</key><array /></map>");
|
||||
|
||||
if(tmpbadfolders.Length > 0)
|
||||
{
|
||||
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
|
||||
{
|
||||
response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
|
||||
}
|
||||
lastresponse.Append("<map><key>bad_folders</key><array>");
|
||||
lastresponse.Append(tmpbadfolders.ToString());
|
||||
lastresponse.Append("</array></map>");
|
||||
}
|
||||
lastresponse.Append("</llsd>");
|
||||
|
||||
// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request");
|
||||
//m_log.Debug("[WEB FETCH INV DESC HANDLER] "+response);
|
||||
|
||||
return response;
|
||||
|
||||
// }
|
||||
return lastresponse.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -61,7 +61,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
public UUID reqID;
|
||||
public Hashtable request;
|
||||
public ScenePresence presence;
|
||||
public List<UUID> folders;
|
||||
}
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
@ -296,7 +295,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
reqinfo.reqID = x;
|
||||
reqinfo.request = y;
|
||||
reqinfo.presence = sp;
|
||||
reqinfo.folders = new List<UUID>();
|
||||
|
||||
/* why where we doing this? just to get cof ?
|
||||
List<UUID> folders = new List<UUID>();
|
||||
|
||||
// Decode the request here
|
||||
string request = y["body"].ToString();
|
||||
|
@ -333,11 +334,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
UUID folderID;
|
||||
if (UUID.TryParse(folder, out folderID))
|
||||
{
|
||||
if (!reqinfo.folders.Contains(folderID))
|
||||
if (!folders.Contains(folderID))
|
||||
{
|
||||
if (sp.COF != UUID.Zero && sp.COF == folderID)
|
||||
highPriority = true;
|
||||
reqinfo.folders.Add(folderID);
|
||||
folders.Add(folderID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -345,6 +346,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
if (highPriority)
|
||||
m_queue.PriorityEnqueue(reqinfo);
|
||||
else
|
||||
*/
|
||||
m_queue.Enqueue(reqinfo);
|
||||
};
|
||||
|
||||
|
@ -406,7 +408,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
if(dropedResponses.Contains(requestID))
|
||||
{
|
||||
dropedResponses.Remove(requestID);
|
||||
requestinfo.folders.Clear();
|
||||
requestinfo.request.Clear();
|
||||
WebFetchInvDescModule.ProcessedRequestsCount++;
|
||||
return;
|
||||
|
@ -417,7 +418,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
m_log.WarnFormat("[FETCH INVENTORY DESCENDENTS2 MODULE]: Caught in the act of loosing responses! Please report this on mantis #7054");
|
||||
responses[requestID] = response;
|
||||
}
|
||||
requestinfo.folders.Clear();
|
||||
requestinfo.request.Clear();
|
||||
WebFetchInvDescModule.ProcessedRequestsCount++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue