From 078643a017cd94dce2d16e4c8db3cc18fd95ed9d Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Thu, 31 Jul 2008 16:05:50 +0000
Subject: * refactor: Change CachedUserInfo.HasInventory to
HasReceivedInventory to make actual function clearer
---
.../Communications/Cache/CachedUserInfo.cs | 29 +++++++++++-----------
.../Cache/UserProfileCacheService.cs | 8 +++---
2 files changed, 18 insertions(+), 19 deletions(-)
(limited to 'OpenSim/Framework/Communications/Cache')
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 4c0aaa2..d6e1715 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -66,7 +66,8 @@ namespace OpenSim.Framework.Communications.Cache
///
/// Has we received the user's inventory from the inventory service?
///
- private bool m_hasInventory;
+ public bool HasReceivedInventory { get { return m_hasReceivedInventory; } }
+ private bool m_hasReceivedInventory;
///
/// Inventory requests waiting for receipt of this user's inventory from the inventory service.
@@ -74,12 +75,10 @@ namespace OpenSim.Framework.Communications.Cache
private readonly IList m_pendingRequests = new List();
///
- /// Has this user info object yet received its inventory information from the invetnroy service?
+ /// The root folder of this user's inventory. Returns null if the inventory has not yet been received.
///
- public bool HasInventory { get { return m_hasInventory; } }
-
- private InventoryFolderImpl m_rootFolder;
public InventoryFolderImpl RootFolder { get { return m_rootFolder; } }
+ private InventoryFolderImpl m_rootFolder;
///
/// FIXME: This could be contained within a local variable - it doesn't need to be a field
@@ -126,7 +125,7 @@ namespace OpenSim.Framework.Communications.Cache
{
lock (m_pendingRequests)
{
- if (m_hasInventory)
+ if (HasReceivedInventory)
{
request.Execute();
}
@@ -216,7 +215,7 @@ namespace OpenSim.Framework.Communications.Cache
{
// We're going to change inventory status within the lock to avoid a race condition
// where requests are processed after the AddRequest() method has been called.
- m_hasInventory = true;
+ m_hasReceivedInventory = true;
foreach (IInventoryRequest request in m_pendingRequests)
{
@@ -318,7 +317,7 @@ namespace OpenSim.Framework.Communications.Cache
// m_log.DebugFormat(
// "[AGENT INVENTORY]: Creating inventory folder {0} {1} for {2} {3}", folderID, folderName, remoteClient.Name, remoteClient.AgentId);
- if (HasInventory)
+ if (m_hasReceivedInventory)
{
InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID);
@@ -393,7 +392,7 @@ namespace OpenSim.Framework.Communications.Cache
// m_log.DebugFormat(
// "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId);
- if (HasInventory)
+ if (m_hasReceivedInventory)
{
InventoryFolderBase baseFolder = new InventoryFolderBase();
baseFolder.Owner = m_userProfile.ID;
@@ -445,7 +444,7 @@ namespace OpenSim.Framework.Communications.Cache
// "[AGENT INVENTORY]: Moving inventory folder {0} into folder {1} for {2} {3}",
// parentID, remoteClient.Name, remoteClient.Name, remoteClient.AgentId);
- if (HasInventory)
+ if (m_hasReceivedInventory)
{
InventoryFolderBase baseFolder = new InventoryFolderBase();
baseFolder.Owner = m_userProfile.ID;
@@ -491,7 +490,7 @@ namespace OpenSim.Framework.Communications.Cache
// m_log.InfoFormat("[AGENT INVENTORY]: Purging folder {0} for {1} uuid {2}",
// folderID, remoteClient.Name, remoteClient.AgentId);
- if (HasInventory)
+ if (m_hasReceivedInventory)
{
InventoryFolderImpl purgedFolder = RootFolder.FindFolder(folderID);
@@ -539,7 +538,7 @@ namespace OpenSim.Framework.Communications.Cache
///
public void AddItem(InventoryItemBase item)
{
- if (HasInventory)
+ if (m_hasReceivedInventory)
{
if (item.Folder == LLUUID.Zero)
{
@@ -575,7 +574,7 @@ namespace OpenSim.Framework.Communications.Cache
///
public void UpdateItem(InventoryItemBase item)
{
- if (HasInventory)
+ if (m_hasReceivedInventory)
{
if (m_commsManager.SecureInventoryService != null)
{
@@ -608,7 +607,7 @@ namespace OpenSim.Framework.Communications.Cache
///
public bool DeleteItem(LLUUID itemID)
{
- if (HasInventory)
+ if (m_hasReceivedInventory)
{
// XXX For historical reasons (grid comms), we need to retrieve the whole item in order to delete, even though
// really only the item id is required.
@@ -656,7 +655,7 @@ namespace OpenSim.Framework.Communications.Cache
/// true if the request was queued or successfully processed, false otherwise
public bool SendInventoryDecendents(IClientAPI client, LLUUID folderID, bool fetchFolders, bool fetchItems)
{
- if (HasInventory)
+ if (m_hasReceivedInventory)
{
InventoryFolderImpl folder;
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 5f98c08..ac52535 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -348,7 +348,7 @@ namespace OpenSim.Framework.Communications.Cache
// This is a crude way of dealing with that by retrying the lookup. It's not quite as bad
// in CAPS as doing this with the udp request, since here it won't hold up other packets.
// In fact, here we'll be generous and try for longer.
- if (!userProfile.HasInventory)
+ if (!userProfile.HasReceivedInventory)
{
int attempts = 0;
while (attempts++ < 30)
@@ -359,14 +359,14 @@ namespace OpenSim.Framework.Communications.Cache
Thread.Sleep(2000);
- if (userProfile.HasInventory)
+ if (userProfile.HasReceivedInventory)
{
break;
}
}
}
- if (userProfile.HasInventory)
+ if (userProfile.HasReceivedInventory)
{
if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null)
{
@@ -434,7 +434,7 @@ namespace OpenSim.Framework.Communications.Cache
CachedUserInfo userProfile;
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
{
- if (userProfile.HasInventory)
+ if (userProfile.HasReceivedInventory)
{
InventoryItemBase item = userProfile.RootFolder.FindItem(itemID);
if (item != null)
--
cgit v1.1