* Eliminate a class of errors where an inventory request could be made before the region had completely received the inventory for the user.

* A much larger race condition where the inventory request could be made before the region gets any data at all will also be fixed in the near future.
* This change also fixes a regression from two patches ago where items stopped appearing in standalone inventory
0.6.0-stable
Justin Clarke Casey 2008-04-11 18:46:54 +00:00
parent 649f304e76
commit 7ac7f79f88
3 changed files with 31 additions and 14 deletions

View File

@ -48,6 +48,14 @@ namespace OpenSim.Framework.Communications.Cache
private UserProfileData m_userProfile;
public UserProfileData UserProfile { get { return m_userProfile; } }
private bool m_hasInventory;
/// <summary>
/// Has this user info object yet received its inventory information from the invetnroy service?
/// </summary>
public bool HasInventory { get { return m_hasInventory; } }
// FIXME: These need to be hidden behind accessors
private InventoryFolderImpl m_rootFolder;
public InventoryFolderImpl RootFolder { get { return m_rootFolder; } }
@ -69,11 +77,6 @@ namespace OpenSim.Framework.Communications.Cache
m_userProfile = userProfile;
}
/// <summary>
/// Has this user info object yet received its inventory information from the invetnroy service?
/// </summary>
public bool HasInventory { get { return RootFolder != null; } }
/// <summary>
/// Store a folder pending categorization when its parent is received.
/// </summary>
@ -142,8 +145,10 @@ namespace OpenSim.Framework.Communications.Cache
}
catch (Exception e)
{
m_log.ErrorFormat("[INVENTORY CACHE]: {0}", e);
m_log.ErrorFormat("[INVENTORY CACHE]: Error processing inventory received from inventory service, {0}", e);
}
m_hasInventory = true;
}
/// <summary>
@ -153,9 +158,9 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="folderInfo"></param>
private void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo)
{
// m_log.DebugFormat(
// "[INVENTORY CACHE]: Received folder {0} {1} for user {2}",
// folderInfo.name, folderInfo.folderID, userID);
m_log.DebugFormat(
"[INVENTORY CACHE]: Received folder {0} {1} for user {2}",
folderInfo.Name, folderInfo.ID, userID);
if (userID == UserProfile.ID)
{
@ -207,6 +212,10 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="folderInfo"></param>
private void ItemReceive(LLUUID userID, InventoryItemBase itemInfo)
{
m_log.DebugFormat(
"[INVENTORY CACHE]: Received item {0} {1} for user {2}",
itemInfo.Name, itemInfo.ID, userID);
if ((userID == UserProfile.ID) && (RootFolder != null))
{
if (itemInfo.Folder == RootFolder.ID)

View File

@ -39,13 +39,18 @@ namespace OpenSim.Region.Communications.Local
/// </summary>
public class LocalInventoryService : InventoryServiceBase
{
private static readonly log4net.ILog m_log
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback)
{
m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID);
List<InventoryFolderBase> skeletonFolders = GetInventorySkeleton(userID);
InventoryFolderImpl rootFolder = null;
ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
ICollection<InventoryItemBase> items = new List<InventoryItemBase>();
List<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
List<InventoryItemBase> items = new List<InventoryItemBase>();
// Need to retrieve the root folder on the first pass
foreach (InventoryFolderBase folder in skeletonFolders)
@ -54,6 +59,7 @@ namespace OpenSim.Region.Communications.Local
{
rootFolder = new InventoryFolderImpl(folder);
folders.Add(rootFolder);
items.AddRange(RequestFolderItems(rootFolder.ID));
}
}
@ -64,6 +70,7 @@ namespace OpenSim.Region.Communications.Local
if (folder.ID != rootFolder.ID)
{
folders.Add(new InventoryFolderImpl(folder));
items.AddRange(RequestFolderItems(folder.ID));
}
}
}

View File

@ -38,7 +38,8 @@ namespace OpenSim.Region.Communications.OGS1
{
public class OGS1InventoryService : IInventoryServices
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static readonly log4net.ILog m_log
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private string _inventoryServerUrl;
private Dictionary<LLUUID, InventoryRequest> m_RequestingInventory = new Dictionary<LLUUID, InventoryRequest>();