From f8a0de591dcb3a4b207378bfb8a0e321022e1c94 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Mon, 10 Jan 2011 16:30:42 -0800 Subject: [PATCH] Handling RemovedObject as event, instead of as object-update as in the previous approach. --- .../SymmetricSync/RegionSyncModule.cs | 74 ++++++++++--------- OpenSim/Region/Framework/Scenes/Scene.cs | 6 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 + .../Framework/Scenes/SceneObjectGroup.cs | 3 + .../Framework/Scenes/SceneObjectPart.cs | 10 +-- 5 files changed, 50 insertions(+), 45 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 0345dda564..93eea92045 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -935,29 +935,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SendSyncMessage(SymmetricSyncMessage.MsgType.Terrain, OSDParser.SerializeJsonString(data)); } - private void HandleRemovedObject(SymmetricSyncMessage msg) - { - // Get the data from message and error check - OSDMap data = DeserializeMessage(msg); - if (data == null) - { - - SymmetricSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); - return; - } - - // Get the parameters from data - //ulong regionHandle = data["regionHandle"].AsULong(); - //uint localID = data["UUID"].AsUInteger(); - UUID sogUUID = data["UUID"].AsUUID(); - - SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(sogUUID); - if (sog != null) - { - m_scene.DeleteSceneObjectBySynchronization(sog); - } - } HashSet exceptions = new HashSet(); private OSDMap DeserializeMessage(SymmetricSyncMessage msg) @@ -990,6 +968,34 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + private void HandleRemovedObject(SymmetricSyncMessage msg) + { + // Get the data from message and error check + OSDMap data = DeserializeMessage(msg); + string init_actorID = data["actorID"].AsString(); + + if (data == null) + { + + SymmetricSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); + return; + } + + UUID sogUUID = data["UUID"].AsUUID(); + + SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(sogUUID); + if (sog != null) + { + m_scene.DeleteSceneObjectBySynchronization(sog); + } + + //if this is a relay node, forwards the event + if (m_isSyncRelay) + { + SendSceneEventToRelevantSyncConnectors(init_actorID, msg); + } + } + /// /// The common actions for handling remote events (event initiated at other actors and propogated here) /// @@ -1230,8 +1236,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } /// - /// Send a sync message to remove the given objects in all connected actors, if this is a relay node. - /// UUID is used for identified a removed object. + /// Send a sync message to remove the given objects in all connected actors. + /// UUID is used for identified a removed object. This function now should + /// only be triggered by an object removal that is initiated locally. /// /// private void RegionSyncModule_OnObjectBeingRemovedFromScene(SceneObjectGroup sog) @@ -1239,18 +1246,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //m_log.DebugFormat("RegionSyncModule_OnObjectBeingRemovedFromScene called at time {0}:{1}:{2}", DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond); //Only send the message out if this is a relay node for sync messages, or this actor caused deleting the object - if (m_isSyncRelay || CheckObjectForSendingUpdate(sog)) - { - OSDMap data = new OSDMap(1); - //data["regionHandle"] = OSD.FromULong(regionHandle); - //data["localID"] = OSD.FromUInteger(sog.LocalId); - data["UUID"] = OSD.FromUUID(sog.UUID); - - SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.RemovedObject, OSDParser.SerializeJsonString(data)); - SendObjectUpdateToRelevantSyncConnectors(sog, rsm); - } + //if (m_isSyncRelay || CheckObjectForSendingUpdate(sog)) + OSDMap data = new OSDMap(1); + //data["regionHandle"] = OSD.FromULong(regionHandle); + //data["localID"] = OSD.FromUInteger(sog.LocalId); + data["UUID"] = OSD.FromUUID(sog.UUID); + data["actorID"] = OSD.FromString(m_actorID); + + SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.RemovedObject, OSDParser.SerializeJsonString(data)); + SendObjectUpdateToRelevantSyncConnectors(sog, rsm); } public void PublishSceneEvent(EventManager.EventNames ev, Object[] evArgs) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index bcbacd3794..07c5d70d6c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -662,7 +662,8 @@ namespace OpenSim.Region.Framework.Scenes if (UnlinkSceneObject(group, false)) { - EventManager.TriggerObjectBeingRemovedFromScene(group); + //For object removals caused by remote events (by other actors), do not trigger local event ObjectBeingRemovedFromScene + //EventManager.TriggerObjectBeingRemovedFromScene(group); EventManager.TriggerParcelPrimCountTainted(); } @@ -2424,12 +2425,13 @@ namespace OpenSim.Region.Framework.Scenes //SYMMETRIC SYNC //Set the ActorID and TimeStamp info for this latest update + /* foreach (SceneObjectPart part in group.Parts) { part.SyncInfoUpdate(); } //end of SYMMETRIC SYNC - + * */ } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 8c7bfca9c2..8666fe8ab9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -478,10 +478,12 @@ namespace OpenSim.Region.Framework.Scenes { updates = new List(m_updateList.Values); + /* if (updates.Count > 0) { m_log.Debug("SceneGraph: " + updates.Count + " objects to send updates for"); } + * */ m_updateList.Clear(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8bc467c3bd..2a8f2990b6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1155,12 +1155,15 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart part = parts[i]; + //SYMMETRIC SYNC: object remove should be handled through RegionSyncModule + /* // REGION SYNC if (Scene.IsSyncedServer()) { Scene.RegionSyncServerModule.DeleteObject(part.RegionHandle, part.LocalId, part); //return; } + * */ Scene.ForEachScenePresence(delegate(ScenePresence avatar) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index dfc752a4e8..c8941f1c55 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5066,14 +5066,6 @@ namespace OpenSim.Region.Framework.Scenes this.m_lastUpdateActorID = updatedPart.LastUpdateActorID; this.m_lastUpdateTimeStamp = updatedPart.LastUpdateTimeStamp; - - /* - this.m_inventory.Items = (TaskInventoryDictionary)updatedPart.m_inventory.Items.Clone(); - //update shape information, for now, only update fileds in Shape whose set functions are defined in PrimitiveBaseShape - this.Shape = updatedPart.Shape.Copy(); - this.Shape.TextureEntry = updatedPart.Shape.TextureEntry; - * */ - return partUpdateResult; } @@ -5083,7 +5075,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void ScheduleFullUpdate_SyncInfoUnchanged() { - m_log.DebugFormat("[SCENE OBJECT PART]: ScheduleFullUpdate_SyncInfoUnchanged for {0} {1}", Name, LocalId); + //m_log.DebugFormat("[SCENE OBJECT PART]: ScheduleFullUpdate_SyncInfoUnchanged for {0} {1}", Name, LocalId); if (m_parentGroup != null) {