From a5176c2e2c4d2791ec15a22db4309bb15bc3ae98 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 11 Apr 2008 18:13:10 +0000 Subject: * Change inventory async response deliver to deliver all items and folders at once, rather than each individual * This is required in order to work towards eliminating some inventory race conditions and to better deal with situations where a grid inventory server is slow or not responding. --- .../Communications/Local/LocalInventoryService.cs | 45 ++++++++-------------- 1 file changed, 15 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region/Communications/Local/LocalInventoryService.cs') diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index bb3db9d..13cb6de 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs @@ -39,32 +39,38 @@ namespace OpenSim.Region.Communications.Local /// public class LocalInventoryService : InventoryServiceBase { - public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, - InventoryItemInfo itemCallBack) + public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback) { - List folders = GetInventorySkeleton(userID); - + List skeletonFolders = GetInventorySkeleton(userID); InventoryFolderImpl rootFolder = null; + + ICollection folders = new List(); + ICollection items = new List(); - //need to make sure we send root folder first - foreach (InventoryFolderBase folder in folders) + // Need to retrieve the root folder on the first pass + foreach (InventoryFolderBase folder in skeletonFolders) { if (folder.ParentID == LLUUID.Zero) { - rootFolder = RequestInventoryFolder(userID, folder, folderCallBack, itemCallBack); + //rootFolder = RequestInventoryFolder(userID, folder, callback); + rootFolder = new InventoryFolderImpl(folder); + folders.Add(rootFolder); } } if (rootFolder != null) { - foreach (InventoryFolderBase folder in folders) + foreach (InventoryFolderBase folder in skeletonFolders) { if (folder.ID != rootFolder.ID) { - RequestInventoryFolder(userID, folder, folderCallBack, itemCallBack); + //RequestInventoryFolder(userID, folder, callback); + folders.Add(new InventoryFolderImpl(folder)); } } } + + callback(userID, folders, items); } public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) @@ -99,26 +105,5 @@ namespace OpenSim.Region.Communications.Local return true; } } - - /// - /// Send the given inventory folder and its item contents back to the requester. - /// - /// - /// - private InventoryFolderImpl RequestInventoryFolder(LLUUID userID, InventoryFolderBase folder, - InventoryFolderInfo folderCallBack, - InventoryItemInfo itemCallBack) - { - InventoryFolderImpl newFolder = new InventoryFolderImpl(folder); - folderCallBack(userID, newFolder); - - List items = RequestFolderItems(newFolder.ID); - foreach (InventoryItemBase item in items) - { - itemCallBack(userID, item); - } - - return newFolder; - } } } -- cgit v1.1