* Add ability to defer item actions for AddItem() and DeleteItem(). This won't be useful until we let the client cache (again?)

0.6.0-stable
Justin Clarke Casey 2008-05-03 23:33:20 +00:00
parent 56827894e9
commit 27a7391d6b
3 changed files with 25 additions and 6 deletions

View File

@ -35,6 +35,8 @@ using log4net;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
internal delegate void AddItemDelegate(InventoryItemBase itemInfo);
internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo);
internal delegate void DeleteItemDelegate(LLUUID itemID); internal delegate void DeleteItemDelegate(LLUUID itemID);
internal delegate void CreateFolderDelegate(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID); internal delegate void CreateFolderDelegate(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID);
@ -532,13 +534,20 @@ namespace OpenSim.Framework.Communications.Cache
/// Add an item to the user's inventory /// Add an item to the user's inventory
/// </summary> /// </summary>
/// <param name="itemInfo"></param> /// <param name="itemInfo"></param>
public void AddItem(InventoryItemBase itemInfo) public void AddItem(InventoryItemBase item)
{ {
if (HasInventory) if (HasInventory)
{ {
ItemReceive(itemInfo); ItemReceive(item);
m_commsManager.InventoryService.AddItem(itemInfo); m_commsManager.InventoryService.AddItem(item);
} }
else
{
AddRequest(
new InventoryRequest(
Delegate.CreateDelegate(typeof(AddItemDelegate), this, "AddItem"),
new object[] { item }));
}
} }
/// <summary> /// <summary>
@ -546,12 +555,19 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <param name="itemInfo"></param> /// <param name="itemInfo"></param>
public void UpdateItem(InventoryItemBase itemInfo) public void UpdateItem(InventoryItemBase item)
{ {
if (HasInventory) if (HasInventory)
{ {
m_commsManager.InventoryService.UpdateItem(itemInfo); m_commsManager.InventoryService.UpdateItem(item);
} }
else
{
AddRequest(
new InventoryRequest(
Delegate.CreateDelegate(typeof(UpdateItemDelegate), this, "UpdateItem"),
new object[] { item }));
}
} }
/// <summary> /// <summary>

View File

@ -62,7 +62,7 @@ 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 an overloaded inventory server // uncomment me to simulate an overloaded inventory server
Thread.Sleep(18000); //Thread.Sleep(18000);
InventoryCollection invCollection = new InventoryCollection(); InventoryCollection invCollection = new InventoryCollection();

View File

@ -486,6 +486,7 @@ namespace OpenSim.Region.Environment.Scenes
if (userInfo == null) if (userInfo == null)
{ {
m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
return; return;
} }
@ -509,12 +510,14 @@ namespace OpenSim.Region.Environment.Scenes
else else
{ {
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString()); m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString());
return; return;
} }
} }
else else
{ {
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString() + ", no root folder"); m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString() + ", no root folder");
return; return;
} }
} }