From a81edef2b9b32c6697a46f504af679185aab3ceb Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 1 May 2008 21:22:03 +0000 Subject: [PATCH] * Refactor: Remove redundant userID from further up the inventory request chain --- .../Communications/Cache/CachedUserInfo.cs | 2 +- .../Communications/IInventoryServices.cs | 3 ++- .../Local/LocalInventoryService.cs | 6 ++++- .../OGS1/OGS1InventoryService.cs | 25 ++++--------------- 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index adf01b9bf6..aa27abdc97 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -158,7 +158,7 @@ namespace OpenSim.Framework.Communications.Cache /// /// /// - public void InventoryReceive(LLUUID userID, ICollection folders, ICollection items) + public void InventoryReceive(ICollection folders, ICollection items) { // FIXME: Exceptions thrown upwards never appear on the console. Could fix further up if these // are simply being swallowed diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index 5907c381b3..c8a3c85697 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs @@ -34,7 +34,8 @@ namespace OpenSim.Framework.Communications /// /// Callback used when a user's inventory is received from the inventory service /// - public delegate void InventoryReceiptCallback(LLUUID userId, ICollection folders, ICollection items); + public delegate void InventoryReceiptCallback( + ICollection folders, ICollection items); /// /// Defines all the operations one can perform on a user's inventory. diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index 80108e37bf..9e63fbf5f8 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs @@ -77,7 +77,11 @@ namespace OpenSim.Region.Communications.Local } } - callback(userID, folders, items); + m_log.InfoFormat( + "[LOCAL1 INVENTORY SERVICE]: Received inventory response for user {0} containing {1} folders and {2} items", + userID, folders.Count, items.Count); + + callback(folders, items); } public override bool HasInventoryForUser(LLUUID userID) diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index ba91f14cb8..f7037ea8d5 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -44,7 +44,8 @@ namespace OpenSim.Region.Communications.OGS1 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private string _inventoryServerUrl; - private Dictionary m_RequestingInventory = new Dictionary(); + private Dictionary m_RequestingInventory + = new Dictionary(); public OGS1InventoryService(string inventoryServerUrl) { @@ -62,8 +63,7 @@ namespace OpenSim.Region.Communications.OGS1 { if (!m_RequestingInventory.ContainsKey(userID)) { - InventoryRequest request = new InventoryRequest(userID, callback); - m_RequestingInventory.Add(userID, request); + m_RequestingInventory.Add(userID, callback); try { @@ -103,7 +103,7 @@ namespace OpenSim.Region.Communications.OGS1 userID, response.Folders.Count, response.Items.Count); InventoryFolderImpl rootFolder = null; - InventoryRequest request = m_RequestingInventory[userID]; + InventoryReceiptCallback callback = m_RequestingInventory[userID]; ICollection folders = new List(); ICollection items = new List(); @@ -139,7 +139,7 @@ namespace OpenSim.Region.Communications.OGS1 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Did not get back an inventory containing a root folder for user {0}", userID); } - request.Callback(userID, folders, items); + callback(folders, items); m_RequestingInventory.Remove(userID); } @@ -289,20 +289,5 @@ namespace OpenSim.Region.Communications.OGS1 } #endregion - - /// - /// Caches a pending inventory request that has yet to be satisfied by the inventory service - /// - public class InventoryRequest - { - public LLUUID UserID; - public InventoryReceiptCallback Callback; - - public InventoryRequest(LLUUID userId, InventoryReceiptCallback callback) - { - UserID = userId; - Callback = callback; - } - } } }