Insert transaction ID into AssetXferUploader constructor rather than at UploadAsset() to prevent item creation failure when NewInventoryItem thread reachs the object first.
This was preventing the previous race condition fix in 4fc0cfb
from actually working.
This commit also removes some of the pointless transaction id checks - these conditions are already being enforced in AgentAssetsTransactions.
connector_plugin
parent
2f795e4fa6
commit
eb5bec96e4
|
@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
{
|
{
|
||||||
if (!XferUploaders.ContainsKey(transactionID))
|
if (!XferUploaders.ContainsKey(transactionID))
|
||||||
{
|
{
|
||||||
uploader = new AssetXferUploader(this, m_Scene, m_dumpAssetsToFile);
|
uploader = new AssetXferUploader(this, m_Scene, transactionID, m_dumpAssetsToFile);
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[AGENT ASSETS TRANSACTIONS]: Adding asset xfer uploader {0} since it didn't previously exist", transactionID);
|
// "[AGENT ASSETS TRANSACTIONS]: Adding asset xfer uploader {0} since it didn't previously exist", transactionID);
|
||||||
|
@ -151,7 +151,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
AssetXferUploader uploader = RequestXferUploader(transactionID);
|
AssetXferUploader uploader = RequestXferUploader(transactionID);
|
||||||
|
|
||||||
uploader.RequestCreateInventoryItem(
|
uploader.RequestCreateInventoryItem(
|
||||||
remoteClient, transactionID, folderID, callbackID,
|
remoteClient, folderID, callbackID,
|
||||||
description, name, invType, type, wearableType, nextOwnerMask);
|
description, name, invType, type, wearableType, nextOwnerMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
{
|
{
|
||||||
AssetXferUploader uploader = RequestXferUploader(transactionID);
|
AssetXferUploader uploader = RequestXferUploader(transactionID);
|
||||||
|
|
||||||
uploader.RequestUpdateTaskInventoryItem(remoteClient, transactionID, item);
|
uploader.RequestUpdateTaskInventoryItem(remoteClient, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RequestUpdateInventoryItem(IClientAPI remoteClient,
|
public void RequestUpdateInventoryItem(IClientAPI remoteClient,
|
||||||
|
@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
{
|
{
|
||||||
AssetXferUploader uploader = RequestXferUploader(transactionID);
|
AssetXferUploader uploader = RequestXferUploader(transactionID);
|
||||||
|
|
||||||
uploader.RequestUpdateInventoryItem(remoteClient, transactionID, item);
|
uploader.RequestUpdateInventoryItem(remoteClient, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -80,15 +80,32 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
private bool m_storeLocal;
|
private bool m_storeLocal;
|
||||||
private uint nextPerm = 0;
|
private uint nextPerm = 0;
|
||||||
private IClientAPI ourClient;
|
private IClientAPI ourClient;
|
||||||
private UUID TransactionID = UUID.Zero;
|
|
||||||
|
private UUID m_transactionID;
|
||||||
|
|
||||||
private sbyte type = 0;
|
private sbyte type = 0;
|
||||||
private byte wearableType = 0;
|
private byte wearableType = 0;
|
||||||
public ulong XferID;
|
public ulong XferID;
|
||||||
private Scene m_Scene;
|
private Scene m_Scene;
|
||||||
|
|
||||||
public AssetXferUploader(AgentAssetTransactions transactions, Scene scene, bool dumpAssetToFile)
|
/// <summary>
|
||||||
|
/// AssetXferUploader constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='transactions'>/param>
|
||||||
|
/// <param name='scene'></param>
|
||||||
|
/// <param name='transactionID'></param>
|
||||||
|
/// <param name='dumpAssetToFile'>
|
||||||
|
/// If true then when the asset is uploaded it is dumped to a file with the format
|
||||||
|
/// String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat",
|
||||||
|
/// now.Year, now.Month, now.Day, now.Hour, now.Minute,
|
||||||
|
/// now.Second, m_asset.Name, m_asset.Type);
|
||||||
|
/// for debugging purposes.
|
||||||
|
/// </param>
|
||||||
|
public AssetXferUploader(
|
||||||
|
AgentAssetTransactions transactions, Scene scene, UUID transactionID, bool dumpAssetToFile)
|
||||||
{
|
{
|
||||||
m_transactions = transactions;
|
m_transactions = transactions;
|
||||||
|
m_transactionID = transactionID;
|
||||||
m_Scene = scene;
|
m_Scene = scene;
|
||||||
m_dumpAssetToFile = dumpAssetToFile;
|
m_dumpAssetToFile = dumpAssetToFile;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +197,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
m_asset.Local = storeLocal;
|
m_asset.Local = storeLocal;
|
||||||
m_asset.Temporary = tempFile;
|
m_asset.Temporary = tempFile;
|
||||||
|
|
||||||
TransactionID = transaction;
|
|
||||||
m_storeLocal = storeLocal;
|
m_storeLocal = storeLocal;
|
||||||
|
|
||||||
if (m_asset.Data.Length > 2)
|
if (m_asset.Data.Length > 2)
|
||||||
|
@ -225,13 +241,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
// Remove ourselves from the list of transactions if completion was delayed until the transaction
|
// Remove ourselves from the list of transactions if completion was delayed until the transaction
|
||||||
// was complete.
|
// was complete.
|
||||||
// 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(m_transactionID);
|
||||||
}
|
}
|
||||||
else if (m_updateTaskItem)
|
else if (m_updateTaskItem)
|
||||||
{
|
{
|
||||||
StoreAssetForTaskItemUpdate(m_updateTaskItemData);
|
StoreAssetForTaskItemUpdate(m_updateTaskItemData);
|
||||||
|
|
||||||
m_transactions.RemoveXferUploader(TransactionID);
|
m_transactions.RemoveXferUploader(m_transactionID);
|
||||||
}
|
}
|
||||||
else if (m_storeLocal)
|
else if (m_storeLocal)
|
||||||
{
|
{
|
||||||
|
@ -241,7 +257,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}",
|
"[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}",
|
||||||
m_asset.FullID, TransactionID);
|
m_asset.FullID, m_transactionID);
|
||||||
|
|
||||||
if (m_dumpAssetToFile)
|
if (m_dumpAssetToFile)
|
||||||
{
|
{
|
||||||
|
@ -269,11 +285,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RequestCreateInventoryItem(IClientAPI remoteClient,
|
public void RequestCreateInventoryItem(IClientAPI remoteClient,
|
||||||
UUID transactionID, UUID folderID, uint callbackID,
|
UUID folderID, uint callbackID,
|
||||||
string description, string name, sbyte invType,
|
string description, string name, sbyte invType,
|
||||||
sbyte type, byte wearableType, uint nextOwnerMask)
|
sbyte type, byte wearableType, uint nextOwnerMask)
|
||||||
{
|
|
||||||
if (TransactionID == transactionID)
|
|
||||||
{
|
{
|
||||||
InventFolder = folderID;
|
InventFolder = folderID;
|
||||||
m_name = name;
|
m_name = name;
|
||||||
|
@ -300,9 +314,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, InventoryItemBase item)
|
public void RequestUpdateInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
|
||||||
{
|
{
|
||||||
// We must lock to avoid a race with a separate thread uploading the asset.
|
// We must lock to avoid a race with a separate thread uploading the asset.
|
||||||
lock (this)
|
lock (this)
|
||||||
|
@ -333,7 +346,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, UUID transactionID, TaskInventoryItem taskItem)
|
public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, TaskInventoryItem taskItem)
|
||||||
{
|
{
|
||||||
// We must lock to avoid a race with a separate thread uploading the asset.
|
// We must lock to avoid a race with a separate thread uploading the asset.
|
||||||
lock (this)
|
lock (this)
|
||||||
|
|
Loading…
Reference in New Issue