From b41abbd50e82103865c8c9540a4154fc689e37a9 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 10 Apr 2008 17:44:19 +0000 Subject: * Minor: really just comment and subsequent indentation adjustment. Preparation for handling inventory problems where the inventory server receives a request and never responds, or is late in responding --- .../Cache/UserProfileCacheService.cs | 96 +++++++++++++--------- .../Grid/InventoryServer/GridInventoryService.cs | 6 ++ 2 files changed, 61 insertions(+), 41 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 2dc2374..d94ff6c 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -293,64 +293,73 @@ namespace OpenSim.Framework.Communications.Cache folderID, remoteClient.Name); } + /// + /// Handle the caps inventory descendents fetch. + /// + /// Since the folder structure is sent to the client on login, I believe we only need to handle items. + /// + /// + /// + /// + /// + /// + /// + /// public List HandleFetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) { // XXX We're not handling sortOrder yet! - // with CAPS we are only return items in the folders at the moment - // need to find the format that sub folder details are sent in - // if (fetchItems) - // { - InventoryFolderImpl fold = null; - if (folderID == libraryRoot.ID) - { - return libraryRoot.RequestListOfItems(); - } - if ((fold = libraryRoot.HasSubFolder(folderID)) != null) - { - return fold.RequestListOfItems(); - } + InventoryFolderImpl fold = null; + if (folderID == libraryRoot.ID) + { + return libraryRoot.RequestListOfItems(); + } - CachedUserInfo userProfile; - if (m_userProfiles.TryGetValue(agentID, out userProfile)) + if ((fold = libraryRoot.HasSubFolder(folderID)) != null) + { + return fold.RequestListOfItems(); + } + + CachedUserInfo userProfile; + if (m_userProfiles.TryGetValue(agentID, out userProfile)) + { + if (userProfile.RootFolder != null) { - if (userProfile.RootFolder != null) + if (userProfile.RootFolder.ID == folderID) { - if (userProfile.RootFolder.ID == folderID) - { - return userProfile.RootFolder.RequestListOfItems(); - } - else - { - if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null) - { - return fold.RequestListOfItems(); - } - } + return userProfile.RootFolder.RequestListOfItems(); } else { - m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID.ToString()); - - return new List(); ; + if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null) + { + return fold.RequestListOfItems(); + } } } else { - m_log.ErrorFormat( - "[USER CACHE]: HandleFetchInventoryDescendentsCAPS() Could not find user profile for {0}", - agentID); - - return new List(); + m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID.ToString()); + + return new List(); ; } + } + else + { + m_log.ErrorFormat( + "[USER CACHE]: HandleFetchInventoryDescendentsCAPS() Could not find user profile for {0}", + agentID); + + return new List(); + } + + // If we've reached this point then we couldn't find the folder, even though the client thinks + // it exists + m_log.ErrorFormat("[INVENTORY CACHE]: " + + "Could not find folder {0} for user {1}", + folderID, agentID.ToString()); - // If we've reached this point then we couldn't find the folder, even though the client thinks - // it exists - m_log.ErrorFormat("[INVENTORY CACHE]: " + - "Could not find folder {0} for user {1}", - folderID, agentID.ToString()); - // } return new List(); } @@ -400,6 +409,11 @@ namespace OpenSim.Framework.Communications.Cache } } + /// + /// Request the inventory data for the given user. + /// + /// + /// private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) { m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index e30c31e..1ae5243 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs @@ -27,7 +27,10 @@ using System; using System.Collections.Generic; +using System.Threading; + using libsecondlife; + using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Console; @@ -103,6 +106,9 @@ namespace OpenSim.Grid.InventoryServer /// The user's inventory. If an inventory cannot be found then an empty collection is returned. public InventoryCollection GetUserInventory(Guid rawUserID) { + // uncomment me to simulate an overloaded inventory server + //Thread.Sleep(40000); + LLUUID userID = new LLUUID(rawUserID); m_log.InfoFormat("[AGENT INVENTORY]: Processing request for inventory of {0}", userID); -- cgit v1.1