* Removing polling delay for non-CAPS inventory fetch if the client has not yet received data from the inventory service
* Replaced instead with the system now used by other requests where the fetch request is placed on a queue and service when the data comes in0.6.0-stable
parent
835e44b987
commit
3f345bf685
|
@ -44,6 +44,9 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
internal delegate void PurgeFolderDelegate(LLUUID folderID);
|
internal delegate void PurgeFolderDelegate(LLUUID folderID);
|
||||||
internal delegate void UpdateFolderDelegate(string name, LLUUID folderID, ushort type, LLUUID parentID);
|
internal delegate void UpdateFolderDelegate(string name, LLUUID folderID, ushort type, LLUUID parentID);
|
||||||
|
|
||||||
|
internal delegate void SendInventoryDescendentsDelegate(
|
||||||
|
IClientAPI client, LLUUID folderID, bool fetchFolders, bool fetchItems);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores user profile and inventory data received from backend services for a particular user.
|
/// Stores user profile and inventory data received from backend services for a particular user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -557,6 +560,52 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send details of the inventory items and/or folders in a given folder to the client.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="folderID"></param>
|
||||||
|
/// <param name="fetchFolders"></param>
|
||||||
|
/// <param name="fetchItems"></param>
|
||||||
|
/// <returns>true if the request was queued or successfully processed, false otherwise</returns>
|
||||||
|
public bool SendInventoryDecendents(IClientAPI client, LLUUID folderID, bool fetchFolders, bool fetchItems)
|
||||||
|
{
|
||||||
|
if (HasInventory)
|
||||||
|
{
|
||||||
|
InventoryFolderImpl folder;
|
||||||
|
|
||||||
|
if ((folder = RootFolder.FindFolder(folderID)) != null)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[AGENT INVENTORY]: Found folder {0} for client {1}",
|
||||||
|
// folderID, remoteClient.AgentId);
|
||||||
|
|
||||||
|
client.SendInventoryFolderDetails(
|
||||||
|
client.AgentId, folderID, folder.RequestListOfItems(),
|
||||||
|
folder.RequestListOfFolders(), fetchFolders, fetchItems);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[AGENT INVENTORY]: Could not find folder {0} requested by user {1} {2}",
|
||||||
|
folderID, client.Name, client.AgentId);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddRequest(
|
||||||
|
new InventoryRequest(
|
||||||
|
Delegate.CreateDelegate(typeof(SendInventoryDescendentsDelegate), this, "SendInventoryDecendents"),
|
||||||
|
new object[] { client, folderID, fetchFolders, fetchItems }));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -247,7 +247,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
public void HandleFetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID,
|
public void HandleFetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID,
|
||||||
bool fetchFolders, bool fetchItems, int sortOrder)
|
bool fetchFolders, bool fetchItems, int sortOrder)
|
||||||
{
|
{
|
||||||
// XXX We're not handling sortOrder yet!
|
// FIXME MAYBE: We're not handling sortOrder!
|
||||||
|
|
||||||
InventoryFolderImpl fold = null;
|
InventoryFolderImpl fold = null;
|
||||||
if ((fold = libraryRoot.FindFolder(folderID)) != null)
|
if ((fold = libraryRoot.FindFolder(folderID)) != null)
|
||||||
|
@ -262,68 +262,14 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
CachedUserInfo userProfile;
|
CachedUserInfo userProfile;
|
||||||
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
||||||
{
|
{
|
||||||
// XXX: When a client crosses into a scene, their entire inventory is fetched
|
userProfile.SendInventoryDecendents(remoteClient, folderID, fetchFolders, fetchItems);
|
||||||
// asynchronously. However, if the client is logging on and does not have a cached root
|
|
||||||
// folder, then the root folder request usually comes in *before* the async completes, leading to
|
|
||||||
// inventory failure.
|
|
||||||
//
|
|
||||||
// This is a crude way of dealing with that by retrying the lookup.
|
|
||||||
//BUG: This should be replaced with a async event.
|
|
||||||
if (!userProfile.HasInventory)
|
|
||||||
{
|
|
||||||
int attempts = 5;
|
|
||||||
while (attempts-- > 0)
|
|
||||||
{
|
|
||||||
Thread.Sleep(2000);
|
|
||||||
|
|
||||||
if (userProfile.HasInventory)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (userProfile.HasInventory)
|
|
||||||
{
|
|
||||||
if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null)
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[AGENT INVENTORY]: Found folder {0} for client {1}",
|
|
||||||
// folderID, remoteClient.AgentId);
|
|
||||||
|
|
||||||
remoteClient.SendInventoryFolderDetails(
|
|
||||||
remoteClient.AgentId, folderID, fold.RequestListOfItems(),
|
|
||||||
fold.RequestListOfFolders(), fetchFolders, fetchItems);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.WarnFormat(
|
|
||||||
"[AGENT INVENTORY]: Could not find folder {0} requested by user {1} {2}",
|
|
||||||
folderID, remoteClient.Name, remoteClient.AgentId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[AGENT INVENTORY]: Could not find root folder for user {0}", remoteClient.Name);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[AGENT INVENTORY]: Could not find user profile for {0} {1}",
|
"[AGENT INVENTORY]: Could not find user profile for {0} {1}",
|
||||||
remoteClient.Name, remoteClient.AgentId);
|
remoteClient.Name, remoteClient.AgentId);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we've reached this point then we couldn't find the folder, even though the client thinks
|
|
||||||
// it exists
|
|
||||||
m_log.ErrorFormat("[AGENT INVENTORY]: Could not find folder {0} for user {1}",
|
|
||||||
folderID, remoteClient.Name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -345,7 +291,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
// "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
|
// "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
|
||||||
// fetchFolders, fetchItems, folderID, agentID);
|
// fetchFolders, fetchItems, folderID, agentID);
|
||||||
|
|
||||||
// XXX We're not handling sortOrder yet!
|
// FIXME MAYBE: We're not handling sortOrder!
|
||||||
|
|
||||||
InventoryFolderImpl fold;
|
InventoryFolderImpl fold;
|
||||||
if ((fold = libraryRoot.FindFolder(folderID)) != null)
|
if ((fold = libraryRoot.FindFolder(folderID)) != null)
|
||||||
|
|
|
@ -61,6 +61,9 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
|
|
||||||
m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID);
|
m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID);
|
||||||
|
|
||||||
|
// Uncomment me to simulate a slow responding inventory server
|
||||||
|
//Thread.Sleep(16000);
|
||||||
|
|
||||||
InventoryCollection invCollection = new InventoryCollection();
|
InventoryCollection invCollection = new InventoryCollection();
|
||||||
|
|
||||||
List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
|
List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
|
||||||
|
|
Loading…
Reference in New Issue