Move UDP update task item code to AssetXferUploader to match existing create user item and update user item mechanisms
This is done for consistency and to allow removal or some access methods that increase code complexity. However, this path has not been used for a long time, not even by LL 1.23 - viewers use caps http upload for this insteadavinationmerge
parent
1a902fceb5
commit
65e294267d
|
@ -155,56 +155,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
description, name, invType, type, wearableType, nextOwnerMask);
|
description, name, invType, type, wearableType, nextOwnerMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get an uploaded asset. If the data is successfully retrieved,
|
|
||||||
/// the transaction will be removed.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="transactionID"></param>
|
|
||||||
/// <returns>The asset if the upload has completed, null if it has not.</returns>
|
|
||||||
private AssetBase GetTransactionAsset(UUID transactionID)
|
|
||||||
{
|
|
||||||
lock (XferUploaders)
|
|
||||||
{
|
|
||||||
if (XferUploaders.ContainsKey(transactionID))
|
|
||||||
{
|
|
||||||
AssetXferUploader uploader = XferUploaders[transactionID];
|
|
||||||
AssetBase asset = uploader.GetAssetData();
|
|
||||||
RemoveXferUploader(transactionID);
|
|
||||||
|
|
||||||
return asset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient,
|
public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient,
|
||||||
SceneObjectPart part, UUID transactionID,
|
SceneObjectPart part, UUID transactionID,
|
||||||
TaskInventoryItem item)
|
TaskInventoryItem item)
|
||||||
{
|
{
|
||||||
AssetBase asset = GetTransactionAsset(transactionID);
|
AssetXferUploader uploader = RequestXferUploader(transactionID);
|
||||||
|
|
||||||
// Only legacy viewers use this, and they prefer CAPS, which
|
uploader.RequestUpdateTaskInventoryItem(remoteClient, transactionID, item);
|
||||||
// we have, so this really never runs.
|
|
||||||
// Allow it, but only for "safe" types.
|
|
||||||
if ((InventoryType)item.InvType != InventoryType.Notecard &&
|
|
||||||
(InventoryType)item.InvType != InventoryType.LSL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (asset != null)
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[AGENT ASSETS TRANSACTIONS]: Updating item {0} in {1} for transaction {2}",
|
|
||||||
// item.Name, part.Name, transactionID);
|
|
||||||
|
|
||||||
asset.FullID = UUID.Random();
|
|
||||||
asset.Name = item.Name;
|
|
||||||
asset.Description = item.Description;
|
|
||||||
asset.Type = (sbyte)item.Type;
|
|
||||||
item.AssetID = asset.FullID;
|
|
||||||
|
|
||||||
m_Scene.AssetService.Store(asset);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RequestUpdateInventoryItem(IClientAPI remoteClient,
|
public void RequestUpdateInventoryItem(IClientAPI remoteClient,
|
||||||
|
|
|
@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
|
IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}",
|
"[ASSET TRANSACTION MODULE] Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}",
|
||||||
item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName);
|
item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
AgentAssetTransactions transactions =
|
AgentAssetTransactions transactions =
|
||||||
|
|
|
@ -73,11 +73,15 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
private UUID InventFolder = UUID.Zero;
|
private UUID InventFolder = UUID.Zero;
|
||||||
private sbyte invType = 0;
|
private sbyte invType = 0;
|
||||||
|
|
||||||
private bool m_createItem = false;
|
private bool m_createItem;
|
||||||
private uint m_createItemCallback = 0;
|
private uint m_createItemCallback;
|
||||||
private bool m_updateItem = false;
|
|
||||||
|
private bool m_updateItem;
|
||||||
private InventoryItemBase m_updateItemData;
|
private InventoryItemBase m_updateItemData;
|
||||||
|
|
||||||
|
private bool m_updateTaskItem;
|
||||||
|
private TaskInventoryItem m_updateTaskItemData;
|
||||||
|
|
||||||
private string m_description = String.Empty;
|
private string m_description = String.Empty;
|
||||||
private bool m_dumpAssetToFile;
|
private bool m_dumpAssetToFile;
|
||||||
private string m_name = String.Empty;
|
private string m_name = String.Empty;
|
||||||
|
@ -232,6 +236,12 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
// TODO: Should probably do the same for create item.
|
// TODO: Should probably do the same for create item.
|
||||||
m_transactions.RemoveXferUploader(TransactionID);
|
m_transactions.RemoveXferUploader(TransactionID);
|
||||||
}
|
}
|
||||||
|
else if (m_updateTaskItem)
|
||||||
|
{
|
||||||
|
StoreAssetForTaskItemUpdate(m_updateTaskItemData);
|
||||||
|
|
||||||
|
m_transactions.RemoveXferUploader(TransactionID);
|
||||||
|
}
|
||||||
else if (m_storeLocal)
|
else if (m_storeLocal)
|
||||||
{
|
{
|
||||||
m_Scene.AssetService.Store(m_asset);
|
m_Scene.AssetService.Store(m_asset);
|
||||||
|
@ -332,8 +342,30 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, UUID transactionID, TaskInventoryItem taskItem)
|
||||||
|
{
|
||||||
|
// We must lock to avoid a race with a separate thread uploading the asset.
|
||||||
|
lock (this)
|
||||||
|
{
|
||||||
|
m_asset.Name = taskItem.Name;
|
||||||
|
m_asset.Description = taskItem.Description;
|
||||||
|
m_asset.Type = (sbyte)taskItem.Type;
|
||||||
|
taskItem.AssetID = m_asset.FullID;
|
||||||
|
|
||||||
|
if (m_uploadState == UploadState.Complete)
|
||||||
|
{
|
||||||
|
StoreAssetForTaskItemUpdate(taskItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_updateTaskItem = true;
|
||||||
|
m_updateTaskItemData = taskItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Store the asset for the given item.
|
/// Store the asset for the given item when it has been uploaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
private void StoreAssetForItemUpdate(InventoryItemBase item)
|
private void StoreAssetForItemUpdate(InventoryItemBase item)
|
||||||
|
@ -345,6 +377,19 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
m_Scene.AssetService.Store(m_asset);
|
m_Scene.AssetService.Store(m_asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Store the asset for the given task item when it has been uploaded.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="taskItem"></param>
|
||||||
|
private void StoreAssetForTaskItemUpdate(TaskInventoryItem taskItem)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier task item update for {1} for {2}",
|
||||||
|
// m_asset.FullID, taskItem.Name, ourClient.Name);
|
||||||
|
|
||||||
|
m_Scene.AssetService.Store(m_asset);
|
||||||
|
}
|
||||||
|
|
||||||
private void DoCreateItem(uint callbackID)
|
private void DoCreateItem(uint callbackID)
|
||||||
{
|
{
|
||||||
ValidateAssets();
|
ValidateAssets();
|
||||||
|
|
Loading…
Reference in New Issue