From 55442f3644a10a84e56f2b9ffe0f83e9f89bd7f4 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Fri, 22 May 2009 15:18:41 +0000 Subject: From: Alan Webb RequestUserInventory is supposed to drive a supplied callback when it completes. In fact, it fails to do so if the user's inventory does not exist (e.g. the inventory database is unavailable for some reason), and the requestor is left sleeping forever. The code has been modified to return empty lists via the callback as an accurate reflection of what is there: nothing. --- .../Communications/Local/LocalInventoryService.cs | 64 ++++++++++++---------- 1 file changed, 35 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/Communications/Local') diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index d4560be..4ff4e96 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs @@ -48,43 +48,49 @@ namespace OpenSim.Region.Communications.Local { m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID); - List skeletonFolders = GetInventorySkeleton(userID); - if (skeletonFolders == null) - return; - - InventoryFolderImpl rootFolder = null; - List folders = new List(); List items = new List(); - // Need to retrieve the root folder on the first pass - foreach (InventoryFolderBase folder in skeletonFolders) + List skeletonFolders = GetInventorySkeleton(userID); + + if (skeletonFolders != null) { - if (folder.ParentID == UUID.Zero) - { - rootFolder = new InventoryFolderImpl(folder); - folders.Add(rootFolder); - items.AddRange(RequestFolderItems(rootFolder.ID)); - break; // Only 1 root folder per user - } - } + + InventoryFolderImpl rootFolder = null; - if (rootFolder != null) + // Need to retrieve the root folder on the first pass + foreach (InventoryFolderBase folder in skeletonFolders) + { + if (folder.ParentID == UUID.Zero) + { + rootFolder = new InventoryFolderImpl(folder); + folders.Add(rootFolder); + items.AddRange(RequestFolderItems(rootFolder.ID)); + break; // Only 1 root folder per user + } + } + + if (rootFolder != null) + { + foreach (InventoryFolderBase folder in skeletonFolders) + { + if (folder.ID != rootFolder.ID) + { + folders.Add(new InventoryFolderImpl(folder)); + items.AddRange(RequestFolderItems(folder.ID)); + } + } + } + + m_log.InfoFormat( + "[LOCAL INVENTORY SERVICE]: Received inventory response for user {0} containing {1} folders and {2} items", + userID, folders.Count, items.Count); + } + else { - foreach (InventoryFolderBase folder in skeletonFolders) - { - if (folder.ID != rootFolder.ID) - { - folders.Add(new InventoryFolderImpl(folder)); - items.AddRange(RequestFolderItems(folder.ID)); - } - } + m_log.WarnFormat( "[LOCAL INVENTORY SERVICE]: User {0} inventory not available", userID); } - m_log.InfoFormat( - "[LOCAL INVENTORY SERVICE]: Received inventory response for user {0} containing {1} folders and {2} items", - userID, folders.Count, items.Count); - callback(folders, items); } -- cgit v1.1