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 static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private string m_inventoryFileName = String.Empty;
|
|
||||||
private byte[] m_inventoryFileData = new byte[0];
|
private byte[] m_inventoryFileData = new byte[0];
|
||||||
private uint m_inventoryFileNameSerial = 0;
|
private uint m_inventoryFileNameSerial = 0;
|
||||||
private bool m_inventoryPrivileged = false;
|
private bool m_inventoryPrivileged = false;
|
||||||
|
private object m_inventoryFileLock = new object();
|
||||||
|
|
||||||
private Dictionary<UUID, ArrayList> m_scriptErrors = new Dictionary<UUID, ArrayList>();
|
private Dictionary<UUID, ArrayList> m_scriptErrors = new Dictionary<UUID, ArrayList>();
|
||||||
|
|
||||||
|
@ -1110,23 +1110,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return -1;
|
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>
|
/// <summary>
|
||||||
/// Serialize all the metadata for the items in this prim's inventory ready for sending to the client
|
/// 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>
|
/// <param name="xferManager"></param>
|
||||||
public void RequestInventoryFile(IClientAPI client, IXfer xferManager)
|
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;
|
bool includeAssets = false;
|
||||||
if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId))
|
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)
|
if (m_inventoryPrivileged != includeAssets)
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
|
|
||||||
|
|
||||||
Items.LockItemsForRead(true);
|
Items.LockItemsForRead(true);
|
||||||
|
|
||||||
|
@ -1163,20 +1158,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (!changed)
|
if (!changed)
|
||||||
{
|
{
|
||||||
if (m_inventoryFileData.Length > 2)
|
xferManager.AddNewFile(filename,
|
||||||
{
|
|
||||||
xferManager.AddNewFile(m_inventoryFileName,
|
|
||||||
m_inventoryFileData);
|
m_inventoryFileData);
|
||||||
client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial,
|
client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,
|
||||||
Util.StringToBytes256(m_inventoryFileName));
|
Util.StringToBytes256(filename));
|
||||||
|
|
||||||
Items.LockItemsForRead(false);
|
Items.LockItemsForRead(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
m_inventoryPrivileged = includeAssets;
|
m_inventoryPrivileged = includeAssets;
|
||||||
|
|
||||||
|
InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
{
|
{
|
||||||
UUID ownerID = item.OwnerID;
|
UUID ownerID = item.OwnerID;
|
||||||
|
@ -1231,14 +1225,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (m_inventoryFileData.Length > 2)
|
if (m_inventoryFileData.Length > 2)
|
||||||
{
|
{
|
||||||
xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData);
|
xferManager.AddNewFile(filename, m_inventoryFileData);
|
||||||
client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial,
|
client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,
|
||||||
Util.StringToBytes256(m_inventoryFileName));
|
Util.StringToBytes256(filename));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
|
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Process inventory backup
|
/// Process inventory backup
|
||||||
|
|
Loading…
Reference in New Issue