From 6cb8b01bef21b71857a1fa7438c1529db489bf4c Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Mon, 7 Feb 2011 14:15:33 -0800 Subject: [PATCH 1/2] Added m_syncEnabled in SceneObjectPart to guard again modifying any syncinfo (timestamp, etc) while deserializing and building SOP/SOG out of sync message. --- .../Framework/Scenes/SceneObjectPart.cs | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8f63e69e6b..af9d853f16 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -776,7 +776,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetScriptAccessPin(value); - UpdateBucketSyncInfo("ScriptAccessPin"); + //UpdateBucketSyncInfo("ScriptAccessPin"); //m_scriptAccessPin = (int)value; } } @@ -1207,7 +1207,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetAcceleration(value); - UpdateBucketSyncInfo("Acceleration"); + //UpdateBucketSyncInfo("Acceleration"); //m_acceleration = value; } } @@ -1223,7 +1223,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetDescription(value); - UpdateBucketSyncInfo("Description"); + //UpdateBucketSyncInfo("Description"); /* m_description = value; PhysicsActor actor = PhysActor; @@ -1254,7 +1254,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetColor(value); - UpdateBucketSyncInfo("Color"); + //UpdateBucketSyncInfo("Color"); //m_color = value; /* ScheduleFullUpdate() need not be called b/c after @@ -1283,7 +1283,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetText(value, false); - UpdateBucketSyncInfo("Text"); + //UpdateBucketSyncInfo("Text"); //m_text = value; } } @@ -1301,7 +1301,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetSitName(value); - UpdateBucketSyncInfo("SitName"); + //UpdateBucketSyncInfo("SitName"); //m_sitName = value; } } @@ -1317,7 +1317,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetTouchName(value); - UpdateBucketSyncInfo("TouchName"); + //UpdateBucketSyncInfo("TouchName"); //m_touchName = value; } } @@ -5861,6 +5861,10 @@ namespace OpenSim.Region.Framework.Scenes //private static Dictionary m_bucketUpdateProcessors = new Dictionary(); private Dictionary m_bucketUpdateProcessors = new Dictionary(); + //Define this as a guard to not to fill in any sync info when not desired, i.e. while de-serializing and building SOP and SOG, where + //property set functions will be called and might trigger UpdateBucketSyncInfo() if not guarded carefully. + private bool m_syncEnabled = false; + public static void InitializeBucketInfo(Dictionary propertyBucketMap, List bucketNames, string actorID) { m_primPropertyBucketMap = propertyBucketMap; @@ -5988,6 +5992,8 @@ namespace OpenSim.Region.Framework.Scenes RegisterBucketUpdateProcessor(); m_BucketUpdateProcessorRegistered = true; } + + m_syncEnabled = true; } /// @@ -5996,7 +6002,7 @@ namespace OpenSim.Region.Framework.Scenes /// Name of the property. Make sure the spelling is consistent with what are defined in PropertyList public void UpdateBucketSyncInfo(string propertyName) { - if (m_bucketSyncInfoList != null && m_bucketSyncInfoList.Count>0) + if (m_syncEnabled && m_bucketSyncInfoList != null && m_bucketSyncInfoList.Count>0) { //int bucketIndex = m_primPropertyBucketMap[propertyName]; string bucketName = m_primPropertyBucketMap[propertyName]; From e9b831b8f4d1339be777b1bf988242e15660ff67 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Mon, 7 Feb 2011 17:16:26 -0800 Subject: [PATCH 2/2] 1. Updated SOP.InventorySerial and SOP.TaskInventory set functions, to make sure only local write accesses trigger UpdateBucketSyncInfo(). 2. LinkObjectsBySync(), DelinkObjectsBySync(), and functions they call into, all updated to set properties via calling SetXXX instead of by "XXX=", so that the set operations won't trigger UpdateBucketSyncInfo(). --- .../SymmetricSync/RegionSyncModule.cs | 4 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 7 ++- .../Framework/Scenes/SceneObjectGroup.cs | 29 ++++++++--- .../Framework/Scenes/SceneObjectPart.cs | 49 ++++++++++++++----- .../Scenes/SceneObjectPartInventory.cs | 8 +-- 5 files changed, 71 insertions(+), 26 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index d289b0c913..4e5c358f37 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -978,6 +978,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //save script state and stop script instances m_scene.EventManager.TriggerOnSymmetricSyncStop(); } + m_synced = true; } else { @@ -1059,11 +1060,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { syncConnector.StartCommThreads(); AddSyncConnector(syncConnector); + m_synced = true; } } - m_synced = true; - return true; } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 74cabc011c..d698e9eb42 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -2145,8 +2145,11 @@ namespace OpenSim.Region.Framework.Scenes // Make sure no child prim is set for sale // So that, on delink, no prims are unwittingly // left for sale and sold off - child.RootPart.ObjectSaleType = 0; - child.RootPart.SalePrice = 10; + //SYMMETRIC SYNC: need to copy value w/o trigger UpdateBucketSyncInfo + //child.RootPart.ObjectSaleType = 0; + //child.RootPart.SalePrice = 10; + child.RootPart.SetObjectSaleType(0); + child.RootPart.SetSalePrice(10); childGroups.Add(child); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3a95d4356d..236a17f1d6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3694,6 +3694,9 @@ namespace OpenSim.Region.Framework.Scenes } //Similar actions with DelinkFromGroup, except that m_scene.AddNewSceneObjectBySync is called + //!!!!!!!!!!!!!!!!!!NOTE!!!!!!!!!!!!!!! + //All SOP properties below is set through calling SetXXX(value) instead of by "XXX=value", as such a value is being changed due to sync ( + //i.e. triggered by remote operation instead of by local operation public SceneObjectGroup DelinkFromGroupBySync(SceneObjectPart linkPart, bool sendEvents) { // m_log.DebugFormat( @@ -3714,7 +3717,8 @@ namespace OpenSim.Region.Framework.Scenes if (parts.Length == 1 && RootPart != null) { // Single prim left - RootPart.LinkNum = 0; + //RootPart.LinkNum = 0; + RootPart.SetLinkNum(0); } else { @@ -3722,13 +3726,18 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart part = parts[i]; if (part.LinkNum > linkPart.LinkNum) - part.LinkNum--; + { + //part.LinkNum--; + part.SetLinkNum(part.LinkNum--); + } } } } - linkPart.ParentID = 0; - linkPart.LinkNum = 0; + //linkPart.ParentID = 0; + //linkPart.LinkNum = 0; + linkPart.SetParentID(0); + linkPart.SetLinkNum(0); if (linkPart.PhysActor != null) { @@ -3742,11 +3751,15 @@ namespace OpenSim.Region.Framework.Scenes Vector3 axPos = linkPart.OffsetPosition; axPos *= parentRot; - linkPart.OffsetPosition = new Vector3(axPos.X, axPos.Y, axPos.Z); - linkPart.GroupPosition = AbsolutePosition + linkPart.OffsetPosition; - linkPart.OffsetPosition = new Vector3(0, 0, 0); + //linkPart.OffsetPosition = new Vector3(axPos.X, axPos.Y, axPos.Z); + //linkPart.GroupPosition = AbsolutePosition + linkPart.OffsetPosition; + //linkPart.OffsetPosition = new Vector3(0, 0, 0); + //linkPart.RotationOffset = worldRot; - linkPart.RotationOffset = worldRot; + linkPart.SetOffsetPosition(new Vector3(axPos.X, axPos.Y, axPos.Z)); + linkPart.SetGroupPosition(AbsolutePosition + linkPart.OffsetPosition); + linkPart.SetOffsetPosition(new Vector3(0, 0, 0)); + linkPart.SetRotationOffset(worldRot); SceneObjectGroup objectGroup = new SceneObjectGroup(linkPart); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index af9d853f16..ccfded4752 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -608,12 +608,18 @@ namespace OpenSim.Region.Framework.Scenes public uint InventorySerial { get { return m_inventory.Serial; } - set { m_inventory.Serial = value; } + set + { + SetInventorySerial(value); + UpdateBucketSyncInfo("InventorySerial"); + //m_inventory.Serial = value; + } } - //SYMMETRIC SYNC: implemented to be consistent with other properties. "m_inventory.Serial" set function will trigger UpdateBucketSyncInfo if appropriate + //SYMMETRIC SYNC: implemented to be consistent with other properties. "m_inventory.Serial" set function will trigger UpdateBucketSyncInfo, + //hence in SetInventorySerial we will call m_inventory.SetSerial to avoid triggering UpdateBucketSyncInfo(). public void SetInventorySerial(uint value) { - m_inventory.Serial = value; + m_inventory.SetSerial(value); } /// @@ -622,12 +628,18 @@ namespace OpenSim.Region.Framework.Scenes public TaskInventoryDictionary TaskInventory { get { return m_inventory.Items; } - set { m_inventory.Items = value; } + set + { + //SetTaskInventory(value); + //UpdateBucketSyncInfo("TaskInventory"); + //SYMMETRIC SYNC: "m_inventory.Items" set function will trigger UpdateBucketSyncInfo if appropriate + m_inventory.Items = value; + } } - //SYMMETRIC SYNC: implemented to be consistent with other properties. "m_inventory.Items" set function will trigger UpdateBucketSyncInfo if appropriate + //SYMMETRIC SYNC: implemented to be consistent with updating values of other properties (w/o triggering UpdateBucketSyncInfo); public void SetTaskInventory(TaskInventoryDictionary value) { - m_inventory.Items = value; + m_inventory.SetItems(value); } /// @@ -776,7 +788,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetScriptAccessPin(value); - //UpdateBucketSyncInfo("ScriptAccessPin"); + UpdateBucketSyncInfo("ScriptAccessPin"); //m_scriptAccessPin = (int)value; } } @@ -1317,7 +1329,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetTouchName(value); - //UpdateBucketSyncInfo("TouchName"); + UpdateBucketSyncInfo("TouchName"); //m_touchName = value; } } @@ -1349,7 +1361,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetClickAction(value); - UpdateBucketSyncInfo("ClickAction"); + //UpdateBucketSyncInfo("ClickAction"); //m_clickAction = value; } } @@ -1574,6 +1586,11 @@ namespace OpenSim.Region.Framework.Scenes get { return _parentID; } set { _parentID = value; } } + //SYMMETRIC SYNC: defined for consistency, for calling SetXXX in sync operations + public void SetParentID(uint value) + { + _parentID = value; + } public int CreationDate { @@ -5917,8 +5934,18 @@ namespace OpenSim.Region.Framework.Scenes SetMaterial(updatedPart.Material); SetPassTouches(updatedPart.PassTouches); //RegionHandle skipped - - + SetScriptAccessPin(updatedPart.ScriptAccessPin); + + //SetAcceleration(updatedPart.Acceleration); + //SetDescription(updatedPart.Description); + //SetColor(updatedPart.Color); + //SetText(updatedPart.Text); + //SetSitName(updatedPart.SitName); + + SetTouchName(updatedPart.TouchName); + SetLinkNum(updatedPart.LinkNum); + //SetClickAction(updatedPart.ClickAction); + SetShape(updatedPart.Shape); m_bucketSyncInfoList[bucketName].LastUpdateTimeStamp = updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 69df8ec153..3a87dda99f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes } //SYMMETRIC SYNC - protected void SetSerial(uint value) + public void SetSerial(uint value) { m_inventorySerial = value; @@ -100,6 +100,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetItems(value); + m_inventorySerial++; m_part.UpdateBucketSyncInfo("TaskInventory"); m_part.UpdateBucketSyncInfo("InventorySerial"); //m_items = value; @@ -107,10 +108,11 @@ namespace OpenSim.Region.Framework.Scenes } } //SYMMETRIC SYNC - protected void SetItems(TaskInventoryDictionary value) + //This is inparticular for updating properties + public void SetItems(TaskInventoryDictionary value) { m_items = value; - m_inventorySerial++; + //m_inventorySerial++; } ///