taskInventory request: give each transfer a diferent filename, Add more
agressive lockavinationmerge
parent
df8eae1957
commit
ffe5ede550
|
@ -46,10 +46,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_inventoryFileName = String.Empty;
|
||||
private byte[] m_inventoryFileData = new byte[0];
|
||||
private uint m_inventoryFileNameSerial = 0;
|
||||
private bool m_inventoryPrivileged = false;
|
||||
private object m_inventoryFileLock = new object();
|
||||
|
||||
private Dictionary<UUID, ArrayList> m_scriptErrors = new Dictionary<UUID, ArrayList>();
|
||||
|
||||
|
@ -1110,23 +1110,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return -1;
|
||||
}
|
||||
|
||||
private bool CreateInventoryFileName()
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[PRIM INVENTORY]: Creating inventory file for {0} {1} {2}, serial {3}",
|
||||
// m_part.Name, m_part.UUID, m_part.LocalId, m_inventorySerial);
|
||||
|
||||
if (m_inventoryFileName == String.Empty ||
|
||||
m_inventoryFileNameSerial < m_inventorySerial)
|
||||
{
|
||||
m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp";
|
||||
m_inventoryFileNameSerial = m_inventorySerial;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serialize all the metadata for the items in this prim's inventory ready for sending to the client
|
||||
|
@ -1134,7 +1117,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="xferManager"></param>
|
||||
public void RequestInventoryFile(IClientAPI client, IXfer xferManager)
|
||||
{
|
||||
bool changed = CreateInventoryFileName();
|
||||
|
||||
lock (m_inventoryFileLock)
|
||||
{
|
||||
string filename = "inventory_" + UUID.Random().ToString() + ".tmp";
|
||||
|
||||
bool changed = false;
|
||||
if (m_inventoryFileNameSerial < m_inventorySerial)
|
||||
{
|
||||
m_inventoryFileNameSerial = m_inventorySerial;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (m_inventoryFileData.Length < 2)
|
||||
changed = true;
|
||||
|
||||
bool includeAssets = false;
|
||||
if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId))
|
||||
|
@ -1143,7 +1139,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (m_inventoryPrivileged != includeAssets)
|
||||
changed = true;
|
||||
|
||||
InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
|
||||
|
||||
Items.LockItemsForRead(true);
|
||||
|
||||
|
@ -1163,20 +1158,19 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (!changed)
|
||||
{
|
||||
if (m_inventoryFileData.Length > 2)
|
||||
{
|
||||
xferManager.AddNewFile(m_inventoryFileName,
|
||||
xferManager.AddNewFile(filename,
|
||||
m_inventoryFileData);
|
||||
client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial,
|
||||
Util.StringToBytes256(m_inventoryFileName));
|
||||
client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,
|
||||
Util.StringToBytes256(filename));
|
||||
|
||||
Items.LockItemsForRead(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_inventoryPrivileged = includeAssets;
|
||||
|
||||
InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
|
||||
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
{
|
||||
UUID ownerID = item.OwnerID;
|
||||
|
@ -1231,14 +1225,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (m_inventoryFileData.Length > 2)
|
||||
{
|
||||
xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData);
|
||||
client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial,
|
||||
Util.StringToBytes256(m_inventoryFileName));
|
||||
xferManager.AddNewFile(filename, m_inventoryFileData);
|
||||
client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,
|
||||
Util.StringToBytes256(filename));
|
||||
return;
|
||||
}
|
||||
|
||||
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process inventory backup
|
||||
|
|
Loading…
Reference in New Issue