diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 184bd4e000..ade7b4e829 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -604,8 +604,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule #endregion Console Command Interface - #region RegionSyncModule members and functions - /////////////////////////////////////////////////////////////////////// // Memeber variables /////////////////////////////////////////////////////////////////////// @@ -1263,21 +1261,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { return part.HasPropertyUpdatedLocally(bucketName); } - - //return (m_isSyncRelay || part.HasPropertyUpdatedLocallyInGivenBucket(bucketName)); - - /* - if (!m_isSyncRelay) - { - return part.HasPropertyUpdatedLocallyInGivenBucket(bucketName); - } - - //if this is a relay node, forward out the updates that have not been sent out since lastUpdateSentTime - if (m_lastUpdateSentTime[bucketName] <= part.BucketSyncInfoList[bucketName].LastUpdateTimeStamp) - return true; - else - return false; - * */ } //by default, there are two property buckets: the "General" bucket and the "Physics" bucket. @@ -2020,6 +2003,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + #region Sync message handlers /// @@ -2042,30 +2026,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } case SymmetricSyncMessage.MsgType.Terrain: { - /* - m_scene.Heightmap.LoadFromXmlString(Encoding.ASCII.GetString(msg.Data, 0, msg.Length)); - //Inform the terrain module that terrain has been updated - m_scene.RequestModuleInterface().TaintTerrain(); - m_log.Debug(LogHeader+": Synchronized terrain"); - * */ HandleTerrainUpdateMessage(msg, senderActorID); return; } case SymmetricSyncMessage.MsgType.GetObjects: { - /* - EntityBase[] entities = m_scene.GetEntities(); - foreach (EntityBase e in entities) - { - if (e is SceneObjectGroup) - { - //string sogxml = SceneObjectSerializer.ToXml2Format((SceneObjectGroup)e); - //SendSyncMessage(SymmetricSyncMessage.MsgType.NewObject, sogxml); - SceneObjectGroup sog = (SceneObjectGroup)e; - HandleGetObjectRequest(syncConnector, sog); - } - } - * */ HandleGetObjectRequest(syncConnector); return; } @@ -2497,6 +2462,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_scene.DelinkObjectsBySync(delinkPrimIDs, beforeDelinkGroupIDs, incomingAfterDelinkGroups); } + #endregion //Sync message handlers + + #region Remote Event handlers /// /// The common actions for handling remote events (event initiated at other actors and propogated here) @@ -2644,58 +2612,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_scene.EventManager.TriggerScriptResetLocally(part.LocalId, itemID); } - /* - /// - /// Special actions for remote event ChatFromClient - /// - /// OSDMap data of event args - private void HandleRemoteEvent_OnChatFromClient(string actorID, ulong evSeqNum, OSDMap data) - { - //m_log.Debug(LogHeader + ": received ChatFromClient from "+actorID+", seq "+evSeqNum); - - OSChatMessage args = new OSChatMessage(); - args.Channel = data["channel"].AsInteger(); - args.Message = data["msg"].AsString(); - args.Position = data["pos"].AsVector3(); - args.From = data["name"].AsString(); - UUID id = data["id"].AsUUID(); - args.Scene = m_scene; - //args.Type = ChatTypeEnum.Say; - args.Type = (ChatTypeEnum) data["type"].AsInteger(); - ScenePresence sp; - m_scene.TryGetScenePresence(id, out sp); - - m_scene.EventManager.TriggerOnChatFromClientLocally(sp, args); //Let WorldCommModule and other modules to catch the event - m_scene.EventManager.TriggerOnChatFromWorldLocally(sp, args); //This is to let ChatModule to get the event and deliver it to avatars - } - - private void HandleRemoteEvent_OnChatFromWorld(string actorID, ulong evSeqNum, OSDMap data) - { - //m_log.Debug(LogHeader + ", " + m_actorID + ": received ChatFromWorld from " + actorID + ", seq " + evSeqNum); - - OSChatMessage args = new OSChatMessage(); - args.Channel = data["channel"].AsInteger(); - args.Message = data["msg"].AsString(); - args.Position = data["pos"].AsVector3(); - args.From = data["name"].AsString(); - UUID id = data["id"].AsUUID(); - args.Scene = m_scene; - //args.Type = ChatTypeEnum.Say; - args.Type = (ChatTypeEnum)data["type"].AsInteger(); - //ScenePresence sp; - //m_scene.TryGetScenePresence(id, out sp); - - m_log.Debug(LogHeader + " TriggerOnChatFromWorldLocally "); - - m_scene.EventManager.TriggerOnChatFromWorldLocally(m_scene, args); - } - - private void HandleRemoteEvent_OnChatBroadcast(string actorID, ulong evSeqNum, OSDMap data) - { - - } - * */ - /// /// Handlers for remote chat events: ChatFromClient, ChatFromWorld, ChatBroadcast /// @@ -2957,42 +2873,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SendSceneEvent(SymmetricSyncMessage.MsgType.ScriptReset, data); } - /* - private void OnLocalChatFromClient(Object sender, OSChatMessage chat) - { - ScenePresence avatar = m_scene.GetScenePresence(chat.SenderUUID); - - if (avatar == null) - { - m_log.Warn(LogHeader + "avatar " + chat.SenderUUID + " not exist locally, NOT sending out ChatFromClient"); - return; - } - - OSDMap data = new OSDMap(); - data["channel"] = OSD.FromInteger(chat.Channel); - data["msg"] = OSD.FromString(chat.Message); - data["pos"] = OSD.FromVector3(chat.Position); - data["name"] = OSD.FromString(avatar.Name); //note this is different from OnLocalChatFromWorld - data["id"] = OSD.FromUUID(chat.SenderUUID); - data["type"] = OSD.FromInteger((int)chat.Type); - SendSceneEvent(SymmetricSyncMessage.MsgType.ChatFromClient, data); - } - - - private void OnLocalChatFromWorld(Object sender, OSChatMessage chat) - { - - OSDMap data = new OSDMap(); - data["channel"] = OSD.FromInteger(chat.Channel); - data["msg"] = OSD.FromString(chat.Message); - data["pos"] = OSD.FromVector3(chat.Position); - data["name"] = OSD.FromString(chat.From); //note this is different from OnLocalChatFromClient - data["id"] = OSD.FromUUID(chat.SenderUUID); - data["type"] = OSD.FromInteger((int)chat.Type); - SendSceneEvent(SymmetricSyncMessage.MsgType.ChatFromWorld, data); - } - * */ - private void OnLocalChatBroadcast(Object sender, OSChatMessage chat) { @@ -3049,49 +2929,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private void OnLocalGrabObject(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { - /* - //we will use the prim's UUID as the identifier, not the localID, to publish the event for the prim - SceneObjectPart part = m_scene.GetSceneObjectPart(localID); - if (part == null) - { - m_log.Warn(LogHeader + ": part with localID " + localID + " not exist"); - return; - } - - //this seems to be useful if the prim touched and the prim handling the touch event are different: - //i.e. a child part is touched, pass the event to root, and root handles the event. then root is the "part", - //and the child part is the "originalPart" - SceneObjectPart originalPart = null; - if (originalID != 0) - { - originalPart = m_scene.GetSceneObjectPart(originalID); - if (originalPart == null) - { - m_log.Warn(LogHeader + ": part with localID " + localID + " not exist"); - return; - } - } - - OSDMap data = new OSDMap(); - data["agentID"] = OSD.FromUUID(remoteClient.AgentId); - data["primID"] = OSD.FromUUID(part.UUID); - if (originalID != 0) - { - data["originalPrimID"] = OSD.FromUUID(originalPart.UUID); - } - else - { - data["originalPrimID"] = OSD.FromUUID(UUID.Zero); - } - data["offsetPos"] = OSD.FromVector3(offsetPos); - - data["binormal"] = OSD.FromVector3(surfaceArgs.Binormal); - data["faceIndex"] = OSD.FromInteger(surfaceArgs.FaceIndex); - data["normal"] = OSD.FromVector3(surfaceArgs.Normal); - data["position"] = OSD.FromVector3(surfaceArgs.Position); - data["stCoord"] = OSD.FromVector3(surfaceArgs.STCoord); - data["uvCoord"] = OSD.FromVector3(surfaceArgs.UVCoord); - * */ OSDMap data = PrepareObjectGrabArgs(localID, originalID, offsetPos, remoteClient, surfaceArgs); SendSceneEvent(SymmetricSyncMessage.MsgType.ObjectGrab, data); } @@ -3174,8 +3011,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { return m_eventSeq++; } + #endregion //Remote Event handlers + + #region Per Property SyncInfo management + public void RecordPrimUpdatesByLocal(SceneObjectPart part, List updatedProperties) + { + + } + + #endregion //Per Property SyncInfo management - #endregion //RegionSyncModule members and functions #region ISyncStatistics private object m_stats = new object(); diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs index 667bf46276..f9ff9be050 100755 --- a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs @@ -67,9 +67,11 @@ namespace OpenSim.Region.Framework.Interfaces List PropertyBucketDescription { get; } //Enqueue updates for scene-objects and scene-presences + //Legacy interface, used in Bucket-sync void QueueSceneObjectPartForUpdate(SceneObjectPart part); void QueueScenePresenceForTerseUpdate(ScenePresence presence); - //void QueueSceneObjectGroupForUpdate(SceneObjectGroup sog); + + void RecordPrimUpdatesByLocal(SceneObjectPart part, List updatedProperties); //The folloiwng calls deal with object updates, and will insert each update into an outgoing queue of each SyncConnector void SendSceneUpdates(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f700c9be8d..c49b0fd62d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3203,10 +3203,15 @@ namespace OpenSim.Region.Framework.Scenes ClearUpdateSchedule(); //SYMMETRIC SYNC + //KittyL: 04/06/2011, No longer calling QueueSceneObjectPartForUpdate + //from here. Local updates are now recorded by calling + //IRegionSyncModule.RecordPrimUpdatesByLocal. + /* if (m_parentGroup.Scene.RegionSyncModule != null) { m_parentGroup.Scene.RegionSyncModule.QueueSceneObjectPartForUpdate((SceneObjectPart)this); } + * */ //end of SYMMETRIC SYNC } @@ -5937,6 +5942,9 @@ namespace OpenSim.Region.Framework.Scenes return partUpdateResult; } + //Implementation of ScheduleFullUpdate and ScheduleTerseUpdate for Bucket + //based synchronization + /* public override void ScheduleFullUpdate(List updatedProperties) { if (updatedProperties != null && updatedProperties.Count > 0) @@ -5964,6 +5972,36 @@ namespace OpenSim.Region.Framework.Scenes base.ScheduleTerseUpdate(updatedProperties); //TaintBucketSyncInfo(property); } + * */ + + //Implementation of ScheduleFullUpdate and ScheduleTerseUpdate for Bucket + //based synchronization + public override void ScheduleFullUpdate(List updatedProperties) + { + if (updatedProperties != null && updatedProperties.Count > 0) + { + if (m_parentGroup != null && m_parentGroup.Scene.RegionSyncModule != null) + { + m_parentGroup.Scene.RegionSyncModule.RecordPrimUpdatesByLocal(this, updatedProperties); + } + } + + base.ScheduleTerseUpdate(updatedProperties); + } + + public override void ScheduleTerseUpdate(List updatedProperties) + { + if (updatedProperties != null && updatedProperties.Count > 0) + { + if (m_parentGroup != null && m_parentGroup.Scene.RegionSyncModule != null) + { + m_parentGroup.Scene.RegionSyncModule.RecordPrimUpdatesByLocal(this, updatedProperties); + } + } + + base.ScheduleTerseUpdate(updatedProperties); + } + /// /// Schedules this prim for a full update, without changing the timestamp or actorID (info on when and who modified any property). @@ -5971,33 +6009,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void ScheduleFullUpdate_SyncInfoUnchanged() { - //m_log.DebugFormat("[SCENE OBJECT PART]: ScheduleFullUpdate_SyncInfoUnchanged for {0} {1}", Name, LocalId); - - if (m_parentGroup != null) - { - m_parentGroup.QueueForUpdateCheck(); - } - - int timeNow = Util.UnixTimeSinceEpoch(); - - // If multiple updates are scheduled on the same second, we still need to perform all of them - // So we'll force the issue by bumping up the timestamp so that later processing sees these need - // to be performed. - if (timeNow <= TimeStampFull) - { - TimeStampFull += 1; - } - else - { - TimeStampFull = (uint)timeNow; - } - - m_updateFlag = 2; - - // m_log.DebugFormat( - // "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}", - // UUID, Name, TimeStampFull); - + base.ScheduleFullUpdate(null); } private bool UpdateCollisionSound(UUID updatedCollisionSound)