From 2f84f2171fb7e17f6c336a4e6db9a04ad822704a Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Dec 2010 20:47:00 +0000 Subject: Make prim inventories a bit more sane --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 23 ++----- .../Framework/Scenes/SceneObjectGroup.Inventory.cs | 43 ------------ .../Framework/Scenes/SceneObjectPartInventory.cs | 76 ++++++++++------------ 3 files changed, 39 insertions(+), 103 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index a1f1ea5..47c574a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -951,23 +951,12 @@ namespace OpenSim.Region.Framework.Scenes /// public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) { - SceneObjectGroup group = GetGroupByPrim(primLocalID); - if (group != null) - { - bool fileChange = group.GetPartInventoryFileName(remoteClient, primLocalID); - if (fileChange) - { - if (XferManager != null) - { - group.RequestInventoryFile(remoteClient, primLocalID, XferManager); - } - } - } - else - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: Inventory requested of prim {0} which doesn't exist", primLocalID); - } + SceneObjectPart part = GetSceneObjectPart(primLocalID); + if (part == null) + return; + + if (XferManager != null) + part.Inventory.RequestInventoryFile(remoteClient, XferManager); } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 6cc7231..50521c4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -77,49 +77,6 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// - /// - /// - /// - public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID) - { - SceneObjectPart part = GetChildPart(localID); - if (part != null) - { - return part.Inventory.GetInventoryFileName(remoteClient, localID); - } - else - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: " + - "Couldn't find part {0} in object group {1}, {2} to retreive prim inventory", - localID, Name, UUID); - } - return false; - } - - /// - /// Return serialized inventory metadata for the given constituent prim - /// - /// - /// - public void RequestInventoryFile(IClientAPI client, uint localID, IXfer xferManager) - { - SceneObjectPart part = GetChildPart(localID); - if (part != null) - { - part.Inventory.RequestInventoryFile(client, xferManager); - } - else - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: " + - "Couldn't find part {0} in object group {1}, {2} to request inventory data", - localID, Name, UUID); - } - } - - /// /// Add an inventory item to a prim in this group. /// /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 8fcfcc5..74b4e54 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -46,6 +46,7 @@ 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 int m_inventoryFileNameSerial = 0; private Dictionary m_scriptErrors = new Dictionary(); @@ -930,39 +931,16 @@ namespace OpenSim.Region.Framework.Scenes return -1; } - public string GetInventoryFileName() + private bool CreateInventoryFileName() { - if (m_inventoryFileName == String.Empty) - m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; - if (m_inventoryFileNameSerial < m_inventorySerial) + if (m_inventoryFileName == String.Empty || + m_inventoryFileNameSerial < m_inventorySerial) { m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; - } - return m_inventoryFileName; - } - - /// - /// Return the name with which a client can request a xfer of this prim's inventory metadata - /// - /// - /// - public bool GetInventoryFileName(IClientAPI client, uint localID) - { -// m_log.DebugFormat( -// "[PRIM INVENTORY]: Received request from client {0} for inventory file name of {1}, {2}", -// client.AgentId, Name, UUID); - - if (m_inventorySerial > 0) - { - client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, - Utils.StringToBytes(GetInventoryFileName())); return true; } - else - { - client.SendTaskInventory(m_part.UUID, 0, new byte[0]); - return false; - } + + return false; } /// @@ -971,19 +949,34 @@ namespace OpenSim.Region.Framework.Scenes /// public void RequestInventoryFile(IClientAPI client, IXfer xferManager) { - byte[] fileData = new byte[0]; + bool changed = CreateInventoryFileName(); - // Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches - // what appears to happen in the Second Life protocol. If this isn't the case. then various functionality - // isn't available (such as drag from prim inventory to agent inventory) InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); - bool includeAssets = false; - if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) - includeAssets = true; - lock (m_items) { + if (m_inventorySerial == 0) // No inventory + { + client.SendTaskInventory(m_part.UUID, 0, new byte[0]); + return; + } + + client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, + Util.StringToBytes256(m_inventoryFileName)); + + if (!changed) + { + if (m_inventoryFileData.Length > 2) + { + xferManager.AddNewFile(m_inventoryFileName, + m_inventoryFileData); + } + } + + bool includeAssets = false; + if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) + includeAssets = true; + foreach (TaskInventoryItem item in m_items.Values) { UUID ownerID = item.OwnerID; @@ -1032,17 +1025,14 @@ namespace OpenSim.Region.Framework.Scenes invString.AddSectionEnd(); } } - int count = m_items.Count; - m_items.LockItemsForRead(false); - fileData = Utils.StringToBytes(invString.BuildString); + int count = m_items.Count; - //m_log.Debug(Utils.BytesToString(fileData)); - //m_log.Debug("[PRIM INVENTORY]: RequestInventoryFile fileData: " + Utils.BytesToString(fileData)); + m_inventoryFileData = Utils.StringToBytes(invString.BuildString); - if (fileData.Length > 2) + if (m_inventoryFileData.Length > 2) { - xferManager.AddNewFile(m_inventoryFileName, fileData); + xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); } } -- cgit v1.1 From c9aa420c2d87da6285007ca52f0defbe60239c91 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Dec 2010 20:48:58 +0000 Subject: Restore CM loking after core extract --- .../Framework/Scenes/SceneObjectPartInventory.cs | 129 ++++++++++----------- 1 file changed, 64 insertions(+), 65 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 74b4e54..8ec9d55 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -953,80 +953,79 @@ namespace OpenSim.Region.Framework.Scenes InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); - lock (m_items) + Items.LockItemsForRead(true); + + if (m_inventorySerial == 0) // No inventory { - if (m_inventorySerial == 0) // No inventory - { - client.SendTaskInventory(m_part.UUID, 0, new byte[0]); - return; - } + client.SendTaskInventory(m_part.UUID, 0, new byte[0]); + return; + } - client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, - Util.StringToBytes256(m_inventoryFileName)); + client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, + Util.StringToBytes256(m_inventoryFileName)); - if (!changed) + if (!changed) + { + if (m_inventoryFileData.Length > 2) { - if (m_inventoryFileData.Length > 2) - { - xferManager.AddNewFile(m_inventoryFileName, - m_inventoryFileData); - } + xferManager.AddNewFile(m_inventoryFileName, + m_inventoryFileData); } + } - bool includeAssets = false; - if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) - includeAssets = true; + bool includeAssets = false; + if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) + includeAssets = true; - foreach (TaskInventoryItem item in m_items.Values) - { - UUID ownerID = item.OwnerID; - uint everyoneMask = 0; - uint baseMask = item.BasePermissions; - uint ownerMask = item.CurrentPermissions; - uint groupMask = item.GroupPermissions; - - invString.AddItemStart(); - invString.AddNameValueLine("item_id", item.ItemID.ToString()); - invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); - - invString.AddPermissionsStart(); - - invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); - invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); - invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask)); - invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); - invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); - - invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); - invString.AddNameValueLine("owner_id", ownerID.ToString()); - - invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); - - invString.AddNameValueLine("group_id", item.GroupID.ToString()); - invString.AddSectionEnd(); - - if (includeAssets) - invString.AddNameValueLine("asset_id", item.AssetID.ToString()); - else - invString.AddNameValueLine("asset_id", UUID.Zero.ToString()); - invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); - invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); - invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); - - invString.AddSaleStart(); - invString.AddNameValueLine("sale_type", "not"); - invString.AddNameValueLine("sale_price", "0"); - invString.AddSectionEnd(); - - invString.AddNameValueLine("name", item.Name + "|"); - invString.AddNameValueLine("desc", item.Description + "|"); - - invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); - invString.AddSectionEnd(); - } + foreach (TaskInventoryItem item in m_items.Values) + { + UUID ownerID = item.OwnerID; + uint everyoneMask = 0; + uint baseMask = item.BasePermissions; + uint ownerMask = item.CurrentPermissions; + uint groupMask = item.GroupPermissions; + + invString.AddItemStart(); + invString.AddNameValueLine("item_id", item.ItemID.ToString()); + invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); + + invString.AddPermissionsStart(); + + invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); + invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); + invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask)); + invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); + invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); + + invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); + invString.AddNameValueLine("owner_id", ownerID.ToString()); + + invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); + + invString.AddNameValueLine("group_id", item.GroupID.ToString()); + invString.AddSectionEnd(); + + if (includeAssets) + invString.AddNameValueLine("asset_id", item.AssetID.ToString()); + else + invString.AddNameValueLine("asset_id", UUID.Zero.ToString()); + invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); + invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); + invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); + + invString.AddSaleStart(); + invString.AddNameValueLine("sale_type", "not"); + invString.AddNameValueLine("sale_price", "0"); + invString.AddSectionEnd(); + + invString.AddNameValueLine("name", item.Name + "|"); + invString.AddNameValueLine("desc", item.Description + "|"); + + invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); + invString.AddSectionEnd(); } - int count = m_items.Count; + Items.LockItemsForRead(false); m_inventoryFileData = Utils.StringToBytes(invString.BuildString); -- cgit v1.1 From 043dace1184b14c1b07863c2ffabaf5e24fb53c4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Dec 2010 20:47:00 +0000 Subject: Make prim inventories a bit more sane --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 23 ++----- .../Framework/Scenes/SceneObjectGroup.Inventory.cs | 43 ------------- .../Framework/Scenes/SceneObjectPartInventory.cs | 74 ++++++++++------------ 3 files changed, 39 insertions(+), 101 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 2cf0ced..321d0aa 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -949,23 +949,12 @@ namespace OpenSim.Region.Framework.Scenes /// public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) { - SceneObjectGroup group = GetGroupByPrim(primLocalID); - if (group != null) - { - bool fileChange = group.GetPartInventoryFileName(remoteClient, primLocalID); - if (fileChange) - { - if (XferManager != null) - { - group.RequestInventoryFile(remoteClient, primLocalID, XferManager); - } - } - } - else - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: Inventory requested of prim {0} which doesn't exist", primLocalID); - } + SceneObjectPart part = GetSceneObjectPart(primLocalID); + if (part == null) + return; + + if (XferManager != null) + part.Inventory.RequestInventoryFile(remoteClient, XferManager); } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index a86223c..982e280 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -81,49 +81,6 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// - /// - /// - /// - public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID) - { - SceneObjectPart part = GetChildPart(localID); - if (part != null) - { - return part.Inventory.GetInventoryFileName(remoteClient, localID); - } - else - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: " + - "Couldn't find part {0} in object group {1}, {2} to retreive prim inventory", - localID, Name, UUID); - } - return false; - } - - /// - /// Return serialized inventory metadata for the given constituent prim - /// - /// - /// - public void RequestInventoryFile(IClientAPI client, uint localID, IXfer xferManager) - { - SceneObjectPart part = GetChildPart(localID); - if (part != null) - { - part.Inventory.RequestInventoryFile(client, xferManager); - } - else - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: " + - "Couldn't find part {0} in object group {1}, {2} to request inventory data", - localID, Name, UUID); - } - } - - /// /// Add an inventory item to a prim in this group. /// /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 6a204c3..ac69f16 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -46,6 +46,7 @@ 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 int m_inventoryFileNameSerial = 0; /// @@ -765,39 +766,16 @@ namespace OpenSim.Region.Framework.Scenes return -1; } - public string GetInventoryFileName() + private bool CreateInventoryFileName() { - if (m_inventoryFileName == String.Empty) - m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; - if (m_inventoryFileNameSerial < m_inventorySerial) + if (m_inventoryFileName == String.Empty || + m_inventoryFileNameSerial < m_inventorySerial) { m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; - } - return m_inventoryFileName; - } - - /// - /// Return the name with which a client can request a xfer of this prim's inventory metadata - /// - /// - /// - public bool GetInventoryFileName(IClientAPI client, uint localID) - { -// m_log.DebugFormat( -// "[PRIM INVENTORY]: Received request from client {0} for inventory file name of {1}, {2}", -// client.AgentId, Name, UUID); - - if (m_inventorySerial > 0) - { - client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, - Utils.StringToBytes(GetInventoryFileName())); return true; } - else - { - client.SendTaskInventory(m_part.UUID, 0, new byte[0]); - return false; - } + + return false; } /// @@ -806,19 +784,34 @@ namespace OpenSim.Region.Framework.Scenes /// public void RequestInventoryFile(IClientAPI client, IXfer xferManager) { - byte[] fileData = new byte[0]; + bool changed = CreateInventoryFileName(); - // Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches - // what appears to happen in the Second Life protocol. If this isn't the case. then various functionality - // isn't available (such as drag from prim inventory to agent inventory) InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); - bool includeAssets = false; - if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) - includeAssets = true; - lock (m_items) { + if (m_inventorySerial == 0) // No inventory + { + client.SendTaskInventory(m_part.UUID, 0, new byte[0]); + return; + } + + client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, + Util.StringToBytes256(m_inventoryFileName)); + + if (!changed) + { + if (m_inventoryFileData.Length > 2) + { + xferManager.AddNewFile(m_inventoryFileName, + m_inventoryFileData); + } + } + + bool includeAssets = false; + if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) + includeAssets = true; + foreach (TaskInventoryItem item in m_items.Values) { UUID ownerID = item.OwnerID; @@ -868,14 +861,13 @@ namespace OpenSim.Region.Framework.Scenes } } - fileData = Utils.StringToBytes(invString.BuildString); + int count = m_items.Count; - //m_log.Debug(Utils.BytesToString(fileData)); - //m_log.Debug("[PRIM INVENTORY]: RequestInventoryFile fileData: " + Utils.BytesToString(fileData)); + m_inventoryFileData = Utils.StringToBytes(invString.BuildString); - if (fileData.Length > 2) + if (m_inventoryFileData.Length > 2) { - xferManager.AddNewFile(m_inventoryFileName, fileData); + xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); } } -- cgit v1.1 From a31b96e1ba755122220d4dd8e5e04d721910a2fc Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Dec 2010 20:54:28 +0000 Subject: Fix up merge artifacts --- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index ac69f16..36c5fc1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -808,10 +808,6 @@ namespace OpenSim.Region.Framework.Scenes } } - bool includeAssets = false; - if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) - includeAssets = true; - foreach (TaskInventoryItem item in m_items.Values) { UUID ownerID = item.OwnerID; @@ -840,10 +836,7 @@ namespace OpenSim.Region.Framework.Scenes invString.AddNameValueLine("group_id", item.GroupID.ToString()); invString.AddSectionEnd(); - if (includeAssets) - invString.AddNameValueLine("asset_id", item.AssetID.ToString()); - else - invString.AddNameValueLine("asset_id", UUID.Zero.ToString()); + invString.AddNameValueLine("asset_id", item.AssetID.ToString()); invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); @@ -861,8 +854,6 @@ namespace OpenSim.Region.Framework.Scenes } } - int count = m_items.Count; - m_inventoryFileData = Utils.StringToBytes(invString.BuildString); if (m_inventoryFileData.Length > 2) -- cgit v1.1 From ec8d1d0131a3e6c28706a29bd2d2d7c4e49d597f Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Dec 2010 22:49:38 +0000 Subject: Added a missed return. Thanks diva! --- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 36c5fc1..dc1447a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -805,6 +805,7 @@ namespace OpenSim.Region.Framework.Scenes { xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); + return; } } -- cgit v1.1 From 19181c019ab5af99e5adb74cc4265b63db00021a Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Dec 2010 22:56:48 +0000 Subject: Another good catch. Update file name serial. --- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index dc1447a..9bf31fa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -772,6 +772,7 @@ namespace OpenSim.Region.Framework.Scenes m_inventoryFileNameSerial < m_inventorySerial) { m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; + m_inventoryFileNameSerial = m_inventorySerial; return true; } -- cgit v1.1 From 1c3e77b728b8a14e64c0fae6814f3edc4a76b40f Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Dec 2010 22:58:52 +0000 Subject: What is the point of using different types to express the same damn thing? --- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 9bf31fa..1177378 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes private string m_inventoryFileName = String.Empty; private byte[] m_inventoryFileData = new byte[0]; - private int m_inventoryFileNameSerial = 0; + private uint m_inventoryFileNameSerial = 0; /// /// The part to which the inventory belongs. -- cgit v1.1 From cf37b3b9434ca940fa635c0e951fa9ac7c07175a Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 22 Dec 2010 03:25:30 +0100 Subject: Prevent a null ref when an avatar login doesn't go as planned --- OpenSim/Region/Framework/Scenes/Scene.cs | 3 ++- OpenSim/Region/Framework/Scenes/SceneViewer.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d915807..deeb817 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1093,6 +1093,7 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); HeartbeatThread.Abort(); + Watchdog.RemoveThread(HeartbeatThread.ManagedThreadId); HeartbeatThread = null; } m_lastUpdate = Util.EnvironmentTickCount(); @@ -4801,7 +4802,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_firstHeartbeat) return; - if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) + if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 10000) StartTimer(); } diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index b44a010..40a73a9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -106,7 +106,7 @@ namespace OpenSim.Region.Framework.Scenes g.ScheduleFullUpdateToAvatar(m_presence); } - while (m_partsUpdateQueue.Count > 0) + while (m_partsUpdateQueue.Count != null && m_partsUpdateQueue.Count > 0) { SceneObjectPart part = m_partsUpdateQueue.Dequeue(); -- cgit v1.1 From 32cc569b008e4d847530577081528c7baf51d8bb Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 22 Dec 2010 13:45:21 +0100 Subject: Fix up some locking issues in task inventory. Don't use any prior versions in production! --- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index da1b983..9412e09 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -959,6 +959,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_inventorySerial == 0) // No inventory { client.SendTaskInventory(m_part.UUID, 0, new byte[0]); + Items.LockItemsForRead(false); return; } @@ -971,6 +972,7 @@ namespace OpenSim.Region.Framework.Scenes { xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); + Items.LockItemsForRead(false); return; } } -- cgit v1.1