* Allow folder renaming to complete after an agent inventory has been received by a region from the inventory service

* This replaces the old behaviour of failing straight away, which could cause lost updates if the inventory service was slow in responding
* This is the first baby step to making all inventory requests behave this way, to reduce inventory lossage
This commit is contained in:
Justin Clarke Casey
2008-04-22 17:24:13 +00:00
parent 567a05a9e2
commit 269a2e4b88
4 changed files with 96 additions and 10 deletions

View File

@@ -201,6 +201,9 @@ namespace OpenSim.Framework.Communications.Cache
public void HandleUpdateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort type, string name,
LLUUID parentID)
{
// m_log.DebugFormat(
// "[AGENT INVENTORY] Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId);
CachedUserInfo userProfile;
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
@@ -216,6 +219,10 @@ namespace OpenSim.Framework.Communications.Cache
baseFolder.Version = userProfile.RootFolder.Version;
m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder);
}
else
{
userProfile.AddRequest(new UpdateFolderRequest(this, remoteClient, folderID, type, name, parentID));
}
}
}
@@ -492,4 +499,33 @@ namespace OpenSim.Framework.Communications.Cache
}
}
}
/// <summary>
/// Used to create an update folder request if we haven't yet received the user's inventory
/// </summary>
internal class UpdateFolderRequest : IInventoryRequest
{
private UserProfileCacheService m_userProfileCacheService;
private IClientAPI m_client;
private LLUUID m_folderID;
private ushort m_type;
private string m_name;
private LLUUID m_parentID;
internal UpdateFolderRequest(
UserProfileCacheService cacheService, IClientAPI client, LLUUID folderID, ushort type, string name, LLUUID parentID)
{
m_userProfileCacheService = cacheService;
m_client = client;
m_folderID = folderID;
m_type = type;
m_name = name;
m_parentID = parentID;
}
public void Execute()
{
m_userProfileCacheService.HandleUpdateInventoryFolder(m_client, m_folderID, m_type, m_name, m_parentID);
}
}
}