* Refactor: Move last commit's refactor back to AgentAssetTransactionsManager
* Push asset update (invoked when clothing is altered) down into AgentAssetTransactions from Scene.Inventory.cs to join others * I've tested that clothing creation and update still works, but please let me know if it suddently breaks for you. * Add/correct commentsThreadPoolClientBranch
parent
2018cf312b
commit
365cf8e455
|
@ -136,6 +136,15 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
wearableType, nextOwnerMask);
|
wearableType, nextOwnerMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RequestUpdateInventoryItem(IClientAPI remoteClient, LLUUID transactionID,
|
||||||
|
InventoryItemBase item)
|
||||||
|
{
|
||||||
|
if (XferUploaders.ContainsKey(transactionID))
|
||||||
|
{
|
||||||
|
XferUploaders[transactionID].RequestUpdateInventoryItem(remoteClient, transactionID, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed.
|
/// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed.
|
||||||
|
@ -351,6 +360,44 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RequestUpdateInventoryItem(IClientAPI remoteClient, LLUUID transactionID,
|
||||||
|
InventoryItemBase item)
|
||||||
|
{
|
||||||
|
if (TransactionID == transactionID)
|
||||||
|
{
|
||||||
|
CachedUserInfo userInfo =
|
||||||
|
m_userTransactions.Manager.CommsManager.UserProfileCacheService.GetUserDetails(
|
||||||
|
remoteClient.AgentId);
|
||||||
|
|
||||||
|
if (userInfo != null)
|
||||||
|
{
|
||||||
|
LLUUID assetID = LLUUID.Combine(transactionID, remoteClient.SecureSessionId);
|
||||||
|
|
||||||
|
AssetBase asset
|
||||||
|
= m_userTransactions.Manager.CommsManager.AssetCache.GetAsset(
|
||||||
|
assetID, (item.assetType == (int) AssetType.Texture ? true : false));
|
||||||
|
|
||||||
|
if (asset == null)
|
||||||
|
{
|
||||||
|
asset = m_userTransactions.GetTransactionAsset(transactionID);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset != null && asset.FullID == assetID)
|
||||||
|
{
|
||||||
|
asset.Name = item.inventoryName;
|
||||||
|
asset.Description = item.inventoryDescription;
|
||||||
|
asset.InvType = (sbyte) item.invType;
|
||||||
|
asset.Type = (sbyte) item.assetType;
|
||||||
|
item.assetID = asset.FullID;
|
||||||
|
|
||||||
|
m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
|
||||||
|
}
|
||||||
|
|
||||||
|
userInfo.UpdateItem(remoteClient.AgentId, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DoCreateItem()
|
private void DoCreateItem()
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,8 @@ using libsecondlife;
|
||||||
namespace OpenSim.Framework.Communications.Cache
|
namespace OpenSim.Framework.Communications.Cache
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Manage the collection of agent asset transaction collections. Each agent has its own transaction collection
|
/// Provider handlers for processing asset transactions originating from the agent. This encompasses
|
||||||
|
/// clothing creation and update as well as asset uploads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AgentAssetTransactionsManager
|
public class AgentAssetTransactionsManager
|
||||||
{
|
{
|
||||||
|
@ -62,34 +63,76 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a collection of asset transactions for the given user
|
/// Get the collection of asset transactions for the given user. If one does not already exist, it
|
||||||
|
/// is created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userID"></param>
|
/// <param name="userID"></param>
|
||||||
public void AddUser(LLUUID userID)
|
/// <returns></returns>
|
||||||
|
private AgentAssetTransactions GetUserTransactions(LLUUID userID)
|
||||||
{
|
{
|
||||||
lock (AgentTransactions)
|
lock (AgentTransactions)
|
||||||
{
|
{
|
||||||
if (!AgentTransactions.ContainsKey(userID))
|
if (!AgentTransactions.ContainsKey(userID))
|
||||||
{
|
{
|
||||||
AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
|
AgentAssetTransactions transactions
|
||||||
AgentTransactions.Add(userID, transactions);
|
= new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
|
||||||
|
AgentTransactions.Add(userID, transactions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the collection of asset transactions for the given user.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userID"></param>
|
|
||||||
/// <returns>null if this agent does not have an asset transactions collection</returns>
|
|
||||||
public AgentAssetTransactions GetUserTransactions(LLUUID userID)
|
|
||||||
{
|
|
||||||
if (AgentTransactions.ContainsKey(userID))
|
|
||||||
{
|
|
||||||
return AgentTransactions[userID];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return AgentTransactions[userID];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create an inventory item from data that has been received through a transaction.
|
||||||
|
///
|
||||||
|
/// This is called when new clothing or body parts are created. It may also be called in other
|
||||||
|
/// situations.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="transactionID"></param>
|
||||||
|
/// <param name="folderID"></param>
|
||||||
|
/// <param name="callbackID"></param>
|
||||||
|
/// <param name="description"></param>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <param name="invType"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="wearableType"></param>
|
||||||
|
/// <param name="nextOwnerMask"></param>
|
||||||
|
public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
|
||||||
|
uint callbackID, string description, string name, sbyte invType,
|
||||||
|
sbyte type, byte wearableType, uint nextOwnerMask)
|
||||||
|
{
|
||||||
|
m_log.InfoFormat(
|
||||||
|
"[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
|
||||||
|
|
||||||
|
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
||||||
|
|
||||||
|
transactions.RequestCreateInventoryItem(
|
||||||
|
remoteClient, transactionID, folderID, callbackID, description,
|
||||||
|
name, invType, type, wearableType, nextOwnerMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update an inventory item with data that has been received through a transaction.
|
||||||
|
///
|
||||||
|
/// This is called when clothing or body parts are updated (for instance, with new textures or
|
||||||
|
/// colours). It may also be called in other situations.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="transactionID"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, LLUUID transactionID,
|
||||||
|
InventoryItemBase item)
|
||||||
|
{
|
||||||
|
m_log.InfoFormat(
|
||||||
|
"[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}",
|
||||||
|
item.inventoryName);
|
||||||
|
|
||||||
|
AgentAssetTransactions transactions
|
||||||
|
= CommsManager.TransactionsManager.GetUserTransactions(remoteClient.AgentId);
|
||||||
|
|
||||||
|
transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type,
|
public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type,
|
||||||
|
@ -97,36 +140,39 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
{
|
{
|
||||||
// Console.WriteLine("asset upload of " + assetID);
|
// Console.WriteLine("asset upload of " + assetID);
|
||||||
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
||||||
if (transactions != null)
|
|
||||||
|
AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
|
||||||
|
if (uploader != null)
|
||||||
{
|
{
|
||||||
AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
|
// Upload has already compelted uploading...
|
||||||
if (uploader != null)
|
|
||||||
|
if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile))
|
||||||
{
|
{
|
||||||
// Upload has already compelted uploading...
|
//[commenting out as this removal breaks uploads]
|
||||||
|
/*lock (transactions.XferUploaders)
|
||||||
if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile))
|
|
||||||
{
|
{
|
||||||
//[commenting out as this removal breaks uploads]
|
|
||||||
/*lock (transactions.XferUploaders)
|
// XXX Weak ass way of doing this by directly manipulating this public dictionary, purely temporary
|
||||||
{
|
transactions.XferUploaders.Remove(uploader.TransactionID);
|
||||||
|
|
||||||
// XXX Weak ass way of doing this by directly manipulating this public dictionary, purely temporary
|
//m_log.InfoFormat("[ASSET TRANSACTIONS] Current uploaders: {0}", transactions.XferUploaders.Count);
|
||||||
transactions.XferUploaders.Remove(uploader.TransactionID);
|
}*/
|
||||||
|
|
||||||
//m_log.InfoFormat("[ASSET TRANSACTIONS] Current uploaders: {0}", transactions.XferUploaders.Count);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Conduct an asset transfer from the client.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="xferID"></param>
|
||||||
|
/// <param name="packetID"></param>
|
||||||
|
/// <param name="data"></param>
|
||||||
public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
|
public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
|
||||||
{
|
{
|
||||||
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
||||||
if (transactions != null)
|
|
||||||
{
|
transactions.HandleXfer(xferID, packetID, data);
|
||||||
transactions.HandleXfer(xferID, packetID, data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,6 +253,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (userInfo != null && userInfo.RootFolder != null)
|
if (userInfo != null && userInfo.RootFolder != null)
|
||||||
{
|
{
|
||||||
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
|
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
if (LLUUID.Zero == transactionID)
|
if (LLUUID.Zero == transactionID)
|
||||||
|
@ -265,34 +266,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AgentAssetTransactions transactions
|
CommsManager.TransactionsManager.HandleItemUpdateFromTransaction(
|
||||||
= CommsManager.TransactionsManager.GetUserTransactions(remoteClient.AgentId);
|
remoteClient, transactionID, item);
|
||||||
|
|
||||||
if (transactions != null)
|
|
||||||
{
|
|
||||||
LLUUID assetID = LLUUID.Combine(transactionID, remoteClient.SecureSessionId);
|
|
||||||
AssetBase asset
|
|
||||||
= AssetCache.GetAsset(
|
|
||||||
assetID, (item.assetType == (int) AssetType.Texture ? true : false));
|
|
||||||
|
|
||||||
if (asset == null)
|
|
||||||
{
|
|
||||||
asset = transactions.GetTransactionAsset(transactionID);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (asset != null && asset.FullID == assetID)
|
|
||||||
{
|
|
||||||
asset.Name = item.inventoryName;
|
|
||||||
asset.Description = item.inventoryDescription;
|
|
||||||
asset.InvType = (sbyte) item.invType;
|
|
||||||
asset.Type = (sbyte) item.assetType;
|
|
||||||
item.assetID = asset.FullID;
|
|
||||||
|
|
||||||
AssetCache.AddAsset(asset);
|
|
||||||
}
|
|
||||||
|
|
||||||
userInfo.UpdateItem(remoteClient.AgentId, item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -484,21 +459,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AgentAssetTransactions transactions
|
CommsManager.TransactionsManager.HandleItemCreationFromTransaction(
|
||||||
= CommsManager.TransactionsManager.GetUserTransactions(remoteClient.AgentId);
|
remoteClient, transactionID, folderID, callbackID, description,
|
||||||
|
name, invType, assetType, wearableType, nextOwnerMask);
|
||||||
if (transactions != null)
|
|
||||||
{
|
|
||||||
transactions.RequestCreateInventoryItem(
|
|
||||||
remoteClient, transactionID, folderID, callbackID, description,
|
|
||||||
name, invType, assetType, wearableType, nextOwnerMask);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat(
|
|
||||||
"Agent asset transactions for agent {0} uuid {1} in transaction uuid {2} unexpectedly null!",
|
|
||||||
remoteClient.Name, remoteClient.AgentId, transactionID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1311,7 +1311,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
m_LandManager.sendParcelOverlay(client);
|
m_LandManager.sendParcelOverlay(client);
|
||||||
CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
|
CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
|
||||||
CommsManager.TransactionsManager.AddUser(client.AgentId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void SubscribeToClientEvents(IClientAPI client)
|
protected virtual void SubscribeToClientEvents(IClientAPI client)
|
||||||
|
|
Loading…
Reference in New Issue