From 0688861aa72dc162a3da7b60804ac17ff5908067 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 Nov 2011 22:15:29 +0000 Subject: Use the more extensive Utils.AssetTypeToString()/InventoryTypeToString() conversion rather than the arrays in TaskInventoryItem --- .../Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs') diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs index 17dbcd5..52b5f2c 100644 --- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs @@ -235,10 +235,11 @@ namespace OpenSim.Capabilities.Handlers llsdFolder.folder_id = invFolder.ID; llsdFolder.parent_id = invFolder.ParentID; llsdFolder.name = invFolder.Name; - if (invFolder.Type < 0 || invFolder.Type >= TaskInventoryItem.Types.Length) + + if (!Enum.IsDefined(typeof(AssetType), invFolder.Type)) llsdFolder.type = "-1"; else - llsdFolder.type = TaskInventoryItem.Types[invFolder.Type]; + llsdFolder.type = Utils.AssetTypeToString((AssetType)invFolder.Type); llsdFolder.preferred_type = "-1"; return llsdFolder; -- cgit v1.1 From 676d32974adc913b2902db6cfa456c77bd52cd85 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 Nov 2011 22:46:42 +0000 Subject: Implement the FetchInventoryDescendents2 capability using the same code as WebFetchInventoryDescendents. Enabling this by setting Cap_FetchInventoryDescendents2 = "localhost" in the [ClientStack.LindenCaps] section of OpenSim.ini downloads inventory via http rather than udp in later viewers. --- .../Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs') diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs index 52b5f2c..04fa55c 100644 --- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs @@ -117,7 +117,6 @@ namespace OpenSim.Capabilities.Handlers response += inventoryitemstr; } - if (response.Length == 0) { // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. @@ -135,6 +134,7 @@ namespace OpenSim.Capabilities.Handlers //m_log.Debug("[CAPS] "+response); } + return response; } -- cgit v1.1 From 5b4fe23f7f1877a150ed50dd63beaac762fe8674 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 Nov 2011 23:43:57 +0000 Subject: Resolve error where an unknown asset type would cause the fetch inventory descendents cap to fail. Introduced just a few commits ago in 0688861 --- .../WebFetchInvDescHandler.cs | 83 +++++++++++----------- 1 file changed, 43 insertions(+), 40 deletions(-) (limited to 'OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs') diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs index 04fa55c..08570bc 100644 --- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs @@ -42,7 +42,6 @@ using Caps = OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Capabilities.Handlers { - public class WebFetchInvDescHandler { private static readonly ILog m_log = @@ -60,39 +59,40 @@ namespace OpenSim.Capabilities.Handlers public string FetchInventoryDescendentsRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { -// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request"); - - // nasty temporary hack here, the linden client falsely - // identifies the uuid 00000000-0000-0000-0000-000000000000 - // as a string which breaks us - // - // correctly mark it as a uuid - // - request = request.Replace("00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000"); - - // another hack 1 results in a - // System.ArgumentException: Object type System.Int32 cannot - // be converted to target type: System.Boolean - // - request = request.Replace("fetch_folders0", "fetch_folders0"); - request = request.Replace("fetch_folders1", "fetch_folders1"); - - Hashtable hash = new Hashtable(); - try - { - hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); - } - catch (LLSD.LLSDParseException pe) - { - m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message); - m_log.Error("Request: " + request.ToString()); - } - - ArrayList foldersrequested = (ArrayList)hash["folders"]; - - string response = ""; lock (m_fetchLock) { +// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request {0}", request); + + // nasty temporary hack here, the linden client falsely + // identifies the uuid 00000000-0000-0000-0000-000000000000 + // as a string which breaks us + // + // correctly mark it as a uuid + // + request = request.Replace("00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000"); + + // another hack 1 results in a + // System.ArgumentException: Object type System.Int32 cannot + // be converted to target type: System.Boolean + // + request = request.Replace("fetch_folders0", "fetch_folders0"); + request = request.Replace("fetch_folders1", "fetch_folders1"); + + Hashtable hash = new Hashtable(); + try + { + hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); + } + catch (LLSD.LLSDParseException e) + { + m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace); + m_log.Error("Request: " + request); + } + + ArrayList foldersrequested = (ArrayList)hash["folders"]; + + string response = ""; + for (int i = 0; i < foldersrequested.Count; i++) { string inventoryitemstr = ""; @@ -106,7 +106,7 @@ namespace OpenSim.Capabilities.Handlers } catch (Exception e) { - m_log.Debug("[CAPS]: caught exception doing OSD deserialize" + e); + m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e); } LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest); @@ -130,12 +130,12 @@ namespace OpenSim.Capabilities.Handlers response = "folders" + response + ""; } - //m_log.DebugFormat("[CAPS]: Replying to CAPS fetch inventory request with following xml"); - //m_log.Debug("[CAPS] "+response); +// 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 response; } /// @@ -184,8 +184,9 @@ namespace OpenSim.Capabilities.Handlers return reply; } - public InventoryCollection Fetch(UUID agentID, UUID folderID, UUID ownerID, - bool fetchFolders, bool fetchItems, int sortOrder, out int version) + public InventoryCollection Fetch( + UUID agentID, UUID folderID, UUID ownerID, + bool fetchFolders, bool fetchItems, int sortOrder, out int version) { m_log.DebugFormat( "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", @@ -194,6 +195,7 @@ namespace OpenSim.Capabilities.Handlers version = 0; InventoryFolderImpl fold; if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner) + { if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(folderID)) != null) { InventoryCollection ret = new InventoryCollection(); @@ -202,6 +204,7 @@ namespace OpenSim.Capabilities.Handlers return ret; } + } InventoryCollection contents = new InventoryCollection(); @@ -236,7 +239,7 @@ namespace OpenSim.Capabilities.Handlers llsdFolder.parent_id = invFolder.ParentID; llsdFolder.name = invFolder.Name; - if (!Enum.IsDefined(typeof(AssetType), invFolder.Type)) + if (invFolder.Type == (short)AssetType.Unknown || !Enum.IsDefined(typeof(AssetType), (sbyte)invFolder.Type)) llsdFolder.type = "-1"; else llsdFolder.type = Utils.AssetTypeToString((AssetType)invFolder.Type); -- cgit v1.1 From c5b636469ddaec551101049a0eaf5f1c08fdef1e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Nov 2011 00:13:04 +0000 Subject: Stop locking the requests coming in to WebFetchInvDecHandler. There's no technical reason for this as the methods are thread safe. However, it might have served to slow down requests. --- .../WebFetchInvDescHandler.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs') diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs index 08570bc..de7abe2 100644 --- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs @@ -49,7 +49,7 @@ namespace OpenSim.Capabilities.Handlers private IInventoryService m_InventoryService; private ILibraryService m_LibraryService; - private object m_fetchLock = new Object(); +// private object m_fetchLock = new Object(); public WebFetchInvDescHandler(IInventoryService invService, ILibraryService libService) { @@ -59,8 +59,8 @@ namespace OpenSim.Capabilities.Handlers public string FetchInventoryDescendentsRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { - lock (m_fetchLock) - { +// lock (m_fetchLock) +// { // m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request {0}", request); // nasty temporary hack here, the linden client falsely @@ -135,7 +135,7 @@ namespace OpenSim.Capabilities.Handlers return response; - } +// } } /// @@ -188,9 +188,9 @@ namespace OpenSim.Capabilities.Handlers UUID agentID, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder, out int version) { - m_log.DebugFormat( - "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", - fetchFolders, fetchItems, folderID, agentID); +// m_log.DebugFormat( +// "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", +// fetchFolders, fetchItems, folderID, agentID); version = 0; InventoryFolderImpl fold; @@ -220,7 +220,7 @@ namespace OpenSim.Capabilities.Handlers } else { - // Lost itemsm don't really need a version + // Lost items don't really need a version version = 1; } -- cgit v1.1 From bafea2282a95017099578a0a31a908e746161414 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Nov 2011 01:39:23 +0000 Subject: Rip out unused Scene.HandleFetchInventoryDescendentsCAPS(). This has been handled by WebFetchInvDescHandler.Fetch() for some time. --- .../WebFetchInventoryDescendents/WebFetchInvDescHandler.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs') diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs index de7abe2..2dade5b 100644 --- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs @@ -184,6 +184,17 @@ namespace OpenSim.Capabilities.Handlers return reply; } + /// + /// Handle the caps inventory descendents fetch. + /// + /// + /// + /// + /// + /// + /// + /// + /// An empty InventoryCollection if the inventory look up failed public InventoryCollection Fetch( UUID agentID, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder, out int version) @@ -192,6 +203,8 @@ namespace OpenSim.Capabilities.Handlers // "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", // fetchFolders, fetchItems, folderID, agentID); + // FIXME MAYBE: We're not handling sortOrder! + version = 0; InventoryFolderImpl fold; if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner) -- cgit v1.1