From d52b2b9ee7c189651f9d7c04ddf3df9aa833b7ff Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 16 Sep 2010 20:46:24 +0100 Subject: [PATCH 1/5] minor: remove some mono compiler warnings --- OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs index b47ad5dcb1..fc44358b69 100644 --- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs @@ -84,7 +84,7 @@ namespace OpenSim.Tests.Common.Mock public List getInventoryInFolder(UUID folderID) { - InventoryFolderBase folder = m_folders[folderID]; +// InventoryFolderBase folder = m_folders[folderID]; // m_log.DebugFormat("[MOCK INV DB]: Getting items in folder {0} {1}", folder.Name, folder.ID); @@ -116,7 +116,7 @@ namespace OpenSim.Tests.Common.Mock public List getInventoryFolders(UUID parentID) { - InventoryFolderBase parentFolder = m_folders[parentID]; +// InventoryFolderBase parentFolder = m_folders[parentID]; // m_log.DebugFormat("[MOCK INV DB]: Getting folders in folder {0} {1}", parentFolder.Name, parentFolder.ID); @@ -185,7 +185,7 @@ namespace OpenSim.Tests.Common.Mock public void addInventoryItem(InventoryItemBase item) { - InventoryFolderBase folder = m_folders[item.Folder]; +// InventoryFolderBase folder = m_folders[item.Folder]; // m_log.DebugFormat( // "[MOCK INV DB]: Adding inventory item {0} {1} in {2} {3}", item.Name, item.ID, folder.Name, folder.ID); From 1b2edfe75f4fe8b320f65ad54f6f2b0972fda154 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Sep 2010 23:12:32 +0200 Subject: [PATCH 2/5] JustinCC is evil. f7b28dd3 broke script persistence. This fixes it. --- .../Framework/Interfaces/IEntityInventory.cs | 9 ++++++ .../Framework/Scenes/SceneObjectGroup.cs | 1 + .../Framework/Scenes/SceneObjectPart.cs | 3 +- .../Scenes/SceneObjectPartInventory.cs | 28 +++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 7edb43eda2..2e6faa08a1 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -57,6 +57,15 @@ namespace OpenSim.Region.Framework.Interfaces /// Link number for the part void ResetInventoryIDs(); + /// + /// Reset parent object UUID for all the items in the prim's inventory. + /// + /// + /// If this method is called and there are inventory items, then we regard the inventory as having changed. + /// + /// Link number for the part + void ResetObjectID(); + /// /// Change every item in this inventory to a new owner. /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f9a8d41b5e..833c9d3dd8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -511,6 +511,7 @@ namespace OpenSim.Region.Framework.Scenes if (node.Attributes["UUID"] != null) { UUID itemid = new UUID(node.Attributes["UUID"].Value); + m_log.DebugFormat("[SCRIPT STATE]: Adding state for oldID {0}", itemid); m_savedScriptState.Add(itemid, node.InnerXml); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 024bdc97bf..95cd26f17e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -500,7 +500,7 @@ namespace OpenSim.Region.Framework.Scenes // This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part if (Inventory != null) - Inventory.ResetInventoryIDs(); + Inventory.ResetObjectID(); } } @@ -2763,6 +2763,7 @@ namespace OpenSim.Region.Framework.Scenes UUID = UUID.Random(); LinkNum = linkNum; LocalId = 0; + Inventory.ResetInventoryIDs(); } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 53ddb5de27..fbaa7d4872 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -140,6 +140,34 @@ namespace OpenSim.Region.Framework.Scenes } } + public void ResetObjectID() + { + m_items.LockItemsForWrite(true); + + if (Items.Count == 0) + { + m_items.LockItemsForWrite(false); + return; + } + + HasInventoryChanged = true; + if (m_part.ParentGroup != null) + { + m_part.ParentGroup.HasGroupChanged = true; + } + + IList items = new List(Items.Values); + Items.Clear(); + + foreach (TaskInventoryItem item in items) + { + item.ParentPartID = m_part.UUID; + item.ParentID = m_part.UUID; + Items.Add(item.ItemID, item); + } + m_items.LockItemsForWrite(false); + } + /// /// Change every item in this inventory to a new owner. /// From 670357367e825f194b7993871f1e42af41172a09 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Sep 2010 23:26:53 +0200 Subject: [PATCH 3/5] Removing debug --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 833c9d3dd8..f9a8d41b5e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -511,7 +511,6 @@ namespace OpenSim.Region.Framework.Scenes if (node.Attributes["UUID"] != null) { UUID itemid = new UUID(node.Attributes["UUID"].Value); - m_log.DebugFormat("[SCRIPT STATE]: Adding state for oldID {0}", itemid); m_savedScriptState.Add(itemid, node.InnerXml); } } From 50724292636c1ee68e2d3d215285b52606c6e7f5 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 17 Sep 2010 01:16:21 +0100 Subject: [PATCH 4/5] Send KillPackets on the Task queue rather than the State queue Object updates are sent on the task queue. It's possible for an object update to be placed on the client queue before a kill packet comes along. The kill packet would then be placed on the state queue and possibly get sent before the update If the update gets sent afterwards then client get undeletable no owner objects until relog Placing the kills in the task queue should mean that they are received after updates. The kill record prevents subsequent updates getting on the queue Comments state that updates are sent via the state queue but this isn't true. If this was the case this problem might not exist. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 7 ++++++- OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 8 +++++++- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 4 ++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2163c12ba6..cede0502fd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -1523,7 +1523,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP lock (m_entityUpdates.SyncRoot) { m_killRecord.Add(localID); - OutPacket(kill, ThrottleOutPacketType.State); + + // The throttle queue used here must match that being used for updates. Otherwise, there is a + // chance that a kill packet put on a separate queue will be sent to the client before an existing + // update packet on another queue. Receiving updates after kills results in unowned and undeletable + // scene objects in a viewer until that viewer is relogged in. + OutPacket(kill, ThrottleOutPacketType.Task); } } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 6232c48105..ca5a7bdc4b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -412,8 +412,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// Loops through all of the packet queues for this client and tries to send - /// any outgoing packets, obeying the throttling bucket limits + /// an outgoing packet from each, obeying the throttling bucket limits /// + /// + /// Packet queues are inspected in ascending numerical order starting from 0. Therefore, queues with a lower + /// ThrottleOutPacketType number will see their packet get sent first (e.g. if both Land and Wind queues have + /// packets, then the packet at the front of the Land queue will be sent before the packet at the front of the + /// wind queue). + /// /// This function is only called from a synchronous loop in the /// UDPServer so we don't need to bother making this thread safe /// True if any packets were sent, otherwise false diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 56e8c9be54..cb298fdad0 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -500,6 +500,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // FIXME: Implement? } + /// + /// Actually send a packet to a client. + /// + /// internal void SendPacketFinal(OutgoingPacket outgoingPacket) { UDPPacketBuffer buffer = outgoingPacket.Buffer; From e3f153370566e0fd4b6f63a066e016cb52dcdf62 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 17 Sep 2010 01:21:28 +0100 Subject: [PATCH 5/5] Fix build break by replacing Items.LockItemsForWrite() with lock (Items) {} --- .../Scenes/SceneObjectPartInventory.cs | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index fbaa7d4872..7ba30fcafa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -142,30 +142,29 @@ namespace OpenSim.Region.Framework.Scenes public void ResetObjectID() { - m_items.LockItemsForWrite(true); - - if (Items.Count == 0) + lock (Items) { - m_items.LockItemsForWrite(false); - return; + if (Items.Count == 0) + { + return; + } + + HasInventoryChanged = true; + if (m_part.ParentGroup != null) + { + m_part.ParentGroup.HasGroupChanged = true; + } + + IList items = new List(Items.Values); + Items.Clear(); + + foreach (TaskInventoryItem item in items) + { + item.ParentPartID = m_part.UUID; + item.ParentID = m_part.UUID; + Items.Add(item.ItemID, item); + } } - - HasInventoryChanged = true; - if (m_part.ParentGroup != null) - { - m_part.ParentGroup.HasGroupChanged = true; - } - - IList items = new List(Items.Values); - Items.Clear(); - - foreach (TaskInventoryItem item in items) - { - item.ParentPartID = m_part.UUID; - item.ParentID = m_part.UUID; - Items.Add(item.ItemID, item); - } - m_items.LockItemsForWrite(false); } ///