diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 06cb919c92..c9f0a11d18 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -609,9 +609,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return; } - //First, make sure the linked group has updated timestamp info for synchronization - linkedGroup.BucketSyncInfoUpdate(); - OSDMap data = new OSDMap(); OSDMap encodedSOG = SceneObjectEncoder(linkedGroup); data["linkedGroup"] = encodedSOG; @@ -669,17 +666,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule foreach (SceneObjectGroup afterGroup in afterDelinkGroups) { string groupTempID = "afterGroup" + groupNum; - string sogxml = SceneObjectSerializer.ToXml2Format(afterGroup); - data[groupTempID] = OSD.FromString(sogxml); + //string sogxml = SceneObjectSerializer.ToXml2Format(afterGroup); + //data[groupTempID] = OSD.FromString(sogxml); + OSDMap encodedSOG = SceneObjectEncoder(afterGroup); + data[groupTempID] = encodedSOG; groupNum++; } - //make sure the newly delinked objects have the updated timestamp information - foreach (SceneObjectGroup sog in afterDelinkGroups) - { - sog.BucketSyncInfoUpdate(); - } - SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.DelinkObject, OSDParser.SerializeJsonString(data)); SendDelinkObjectToRelevantSyncConnectors(m_actorID, beforeDelinkGroups, rsm); } @@ -2420,7 +2413,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule OSDMap encodedSOG = (OSDMap)data["linkedGroup"]; SceneObjectGroup linkedGroup; Dictionary primsSyncInfo; - SceneObjectDecoder(encodedSOG, out linkedGroup, out primsSyncInfo); if (linkedGroup == null) @@ -2433,6 +2425,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule int partCount = data["partCount"].AsInteger(); List childrenIDs = new List(); + for (int i = 0; i < partCount; i++) + { + string partTempID = "part" + i; + childrenIDs.Add(data[partTempID].AsUUID()); + } //if this is a relay node, forwards the event if (m_isSyncRelay) @@ -2441,12 +2438,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SendSpecialObjectUpdateToRelevantSyncConnectors(senderActorID, linkedGroup, msg); } - for (int i = 0; i < partCount; i++) - { - string partTempID = "part" + i; - childrenIDs.Add(data[partTempID].AsUUID()); - } - //TEMP SYNC DEBUG //m_log.DebugFormat("{0}: received LinkObject from {1}", LogHeader, senderActorID); @@ -2472,8 +2463,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private void HandleSyncDelinkObject(SymmetricSyncMessage msg, string senderActorID) { - - OSDMap data = DeserializeMessage(msg); if (data == null) { @@ -2485,6 +2474,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule List delinkPrimIDs = new List(); List beforeDelinkGroupIDs = new List(); List incomingAfterDelinkGroups = new List(); + List> incomingPrimSyncInfo = new List>(); int partCount = data["partCount"].AsInteger(); for (int i = 0; i < partCount; i++) @@ -2508,10 +2498,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule for (int i = 0; i < afterGroupsCount; i++) { string groupTempID = "afterGroup" + i; - string sogxml = data[groupTempID].AsString(); - //SceneObjectGroup afterGroup = SceneObjectSerializer.FromXml2Format(sogxml); - SceneObjectGroup afterGroup = DecodeSceneObjectGroup(sogxml); + //string sogxml = data[groupTempID].AsString(); + SceneObjectGroup afterGroup; + OSDMap encodedSOG = (OSDMap)data[groupTempID]; + Dictionary primsSyncInfo; + SceneObjectDecoder(encodedSOG, out afterGroup, out primsSyncInfo); incomingAfterDelinkGroups.Add(afterGroup); + incomingPrimSyncInfo.Add(primsSyncInfo); } //if this is a relay node, forwards the event @@ -2528,6 +2521,26 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_scene.DelinkObjectsBySync(delinkPrimIDs, beforeDelinkGroupIDs, incomingAfterDelinkGroups); + //Sync properties + //Update properties, for each prim in each deLinked-Object + foreach (Dictionary primsSyncInfo in incomingPrimSyncInfo) + { + foreach (KeyValuePair inPrimSyncInfo in primsSyncInfo) + { + UUID primUUID = inPrimSyncInfo.Key; + PrimSyncInfo updatedPrimSyncInfo = inPrimSyncInfo.Value; + + SceneObjectPart part = m_scene.GetSceneObjectPart(primUUID); + if (part == null) + { + m_log.WarnFormat("{0}: HandleSyncDelinkObject, prim {1} not in local Scene Graph after DelinkObjectsBySync is called", LogHeader, primUUID); + } + else + { + m_primSyncInfoManager.UpdatePrimSyncInfoBySync(part, updatedPrimSyncInfo); + } + } + } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 94e4a1aebf..4c3f0fc551 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -846,6 +846,14 @@ namespace OpenSim.Region.Framework.Scenes * */ } + /// + /// Delink objects after receiving DelinkObject sync message. + /// Assumption: the actor whichever initiates the DelinkObject + /// operation has already done premission checking. + /// + /// + /// + /// public void DelinkObjectsBySync(List delinkPrimIDs, List beforeDelinkGroupIDs, List incomingAfterDelinkGroups) { m_sceneGraph.DelinkObjectsBySync(delinkPrimIDs, beforeDelinkGroupIDs, incomingAfterDelinkGroups); diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index eba90bafa5..54717fbb50 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1643,7 +1643,7 @@ namespace OpenSim.Region.Framework.Scenes //Schedule updates as in legacy OpenSim code, to send updates to viewers connected to this actor (at least needed for client managers). //But timestamp won't be changed, so that when other actors get the update, they's simple ignore the updates since they already get them //via the LinkObject message sent above. - parentGroup.ScheduleGroupForFullUpdate_SyncInfoUnchanged(); + parentGroup.ScheduleGroupForFullUpdate(null); //end of DSG SYNC @@ -1782,19 +1782,19 @@ namespace OpenSim.Region.Framework.Scenes afterDelinkGroups.Add(g); } - //SYMMETRIC SYNC + //DSG SYNC //Send out DelinkObject message to other actors to sychronize their object list if (m_parentScene.RegionSyncModule != null) { - m_parentScene.RegionSyncModule.SendDeLinkObject(prims, beforeDelinkGroups, afterDelinkGroups); + m_parentScene.RegionSyncModule.SyncDeLinkObject(prims, beforeDelinkGroups, afterDelinkGroups); } - //Schedule updates as in legacy OpenSim code, to send updates to viewers connected to this actor (at least needed for client managers). - //But timestamp won't be changed, so that when other actors get the update, they's simple ignore the updates since they already get them + //Schedule updates as in legacy OpenSim code, to send updates + //to viewers connected to this actor (at least needed for client managers). foreach (SceneObjectGroup sog in afterDelinkGroups) { - sog.ScheduleGroupForFullUpdate_SyncInfoUnchanged(); + sog.ScheduleGroupForFullUpdate(null); } - //end of SYMMETRIC SYNC + //end of DSG SYNC } finally { @@ -2174,7 +2174,7 @@ namespace OpenSim.Region.Framework.Scenes //NewObject is sent via a specific sync message, not through updates; //hence not passing any property list here in calling //ScheduleGroupForFullUpdate(). - sceneObject.ScheduleGroupForFullUpdate_SyncInfoUnchanged(); + sceneObject.ScheduleGroupForFullUpdate(null); //end of DSG SYNC, Entities.Add(sceneObject); @@ -2283,7 +2283,7 @@ namespace OpenSim.Region.Framework.Scenes parentGroup.TriggerScriptChangedEvent(Changed.LINK); parentGroup.HasGroupChanged = true; //Do not change the timestamp and actorID values - parentGroup.ScheduleGroupForFullUpdate_SyncInfoUnchanged(); + parentGroup.ScheduleGroupForFullUpdate(null); } finally @@ -2302,6 +2302,7 @@ namespace OpenSim.Region.Framework.Scenes public void DelinkObjectsBySync(List delinkPrimIDs, List beforeDelinkGroupIDs, List incomingAfterDelinkGroups) { Dictionary localBeforeDelinkGroups = new Dictionary(); + List localAfterDelinkGroups = new List(); Dictionary delinkPrims = new Dictionary(); bool beforeStateConsistent = true; bool afterStateConsistent = true; @@ -2383,9 +2384,8 @@ namespace OpenSim.Region.Framework.Scenes m_log.Warn("DelinkObjectsBySync: before-delink state not consistent in local copy and the incoming copy. Return without further operations."); }else{ //Next, apply the delink operation locally. - List localAfterDelinkGroups = DelinkObjectsBySync(new List(delinkPrims.Values)); + localAfterDelinkGroups = DelinkObjectsBySync(new List(delinkPrims.Values)); - //Check if local after-state agrees with that in the remote copy, and update the groups' properties if (localAfterDelinkGroups.Count != incomingAfterDelinkGroups.Count) { @@ -2407,11 +2407,16 @@ namespace OpenSim.Region.Framework.Scenes } else { - localAfterGroup.UpdateObjectGroupBySync(incomingAfterDelinkGroupsDictionary[localAfterGroup.UUID]); + //localAfterGroup.UpdateObjectGroupBySync(incomingAfterDelinkGroupsDictionary[localAfterGroup.UUID]); } } } } + + foreach (SceneObjectGroup sog in localAfterDelinkGroups) + { + sog.ScheduleGroupForFullUpdate(null); + } } finally { @@ -2423,7 +2428,7 @@ namespace OpenSim.Region.Framework.Scenes } } - //Similar to DelinkObjects(), w/o triggering any ScheduleFullUpdate(), + //Similar to DelinkObjects(), but calling DelinkFromGroupBySync instead private List DelinkObjectsBySync(List prims) { //!!!Caller of this function should already lock on m_updateLock, so no locking here !!!