Re-implemented SOP.ScheduleFullUpdate and SOP.ScheduleTerseUpdate, calling RecordPrimUpdatesByLocal

to record updated values and timestamp of SOP's updated properties.

Also, removed some code that had been commented out before.
dsg
Huaiyu (Kitty) Liu 2011-04-06 14:38:14 -07:00
parent 2bea8bb4bc
commit fe3d4ec9a8
3 changed files with 55 additions and 196 deletions

View File

@ -604,8 +604,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
#endregion Console Command Interface #endregion Console Command Interface
#region RegionSyncModule members and functions
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// Memeber variables // Memeber variables
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
@ -1263,21 +1261,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
return part.HasPropertyUpdatedLocally(bucketName); 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. //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
/// <summary> /// <summary>
@ -2042,30 +2026,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
case SymmetricSyncMessage.MsgType.Terrain: 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<ITerrainModule>().TaintTerrain();
m_log.Debug(LogHeader+": Synchronized terrain");
* */
HandleTerrainUpdateMessage(msg, senderActorID); HandleTerrainUpdateMessage(msg, senderActorID);
return; return;
} }
case SymmetricSyncMessage.MsgType.GetObjects: 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); HandleGetObjectRequest(syncConnector);
return; return;
} }
@ -2497,6 +2462,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_scene.DelinkObjectsBySync(delinkPrimIDs, beforeDelinkGroupIDs, incomingAfterDelinkGroups); m_scene.DelinkObjectsBySync(delinkPrimIDs, beforeDelinkGroupIDs, incomingAfterDelinkGroups);
} }
#endregion //Sync message handlers
#region Remote Event handlers
/// <summary> /// <summary>
/// The common actions for handling remote events (event initiated at other actors and propogated here) /// 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); m_scene.EventManager.TriggerScriptResetLocally(part.LocalId, itemID);
} }
/*
/// <summary>
/// Special actions for remote event ChatFromClient
/// </summary>
/// <param name="data">OSDMap data of event args</param>
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)
{
}
* */
/// <summary> /// <summary>
/// Handlers for remote chat events: ChatFromClient, ChatFromWorld, ChatBroadcast /// Handlers for remote chat events: ChatFromClient, ChatFromWorld, ChatBroadcast
/// </summary> /// </summary>
@ -2957,42 +2873,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
SendSceneEvent(SymmetricSyncMessage.MsgType.ScriptReset, data); 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) 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) 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); OSDMap data = PrepareObjectGrabArgs(localID, originalID, offsetPos, remoteClient, surfaceArgs);
SendSceneEvent(SymmetricSyncMessage.MsgType.ObjectGrab, data); SendSceneEvent(SymmetricSyncMessage.MsgType.ObjectGrab, data);
} }
@ -3174,8 +3011,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
return m_eventSeq++; return m_eventSeq++;
} }
#endregion //Remote Event handlers
#region Per Property SyncInfo management
public void RecordPrimUpdatesByLocal(SceneObjectPart part, List<SceneObjectPartProperties> updatedProperties)
{
}
#endregion //Per Property SyncInfo management
#endregion //RegionSyncModule members and functions
#region ISyncStatistics #region ISyncStatistics
private object m_stats = new object(); private object m_stats = new object();

View File

@ -67,9 +67,11 @@ namespace OpenSim.Region.Framework.Interfaces
List<string> PropertyBucketDescription { get; } List<string> PropertyBucketDescription { get; }
//Enqueue updates for scene-objects and scene-presences //Enqueue updates for scene-objects and scene-presences
//Legacy interface, used in Bucket-sync
void QueueSceneObjectPartForUpdate(SceneObjectPart part); void QueueSceneObjectPartForUpdate(SceneObjectPart part);
void QueueScenePresenceForTerseUpdate(ScenePresence presence); void QueueScenePresenceForTerseUpdate(ScenePresence presence);
//void QueueSceneObjectGroupForUpdate(SceneObjectGroup sog);
void RecordPrimUpdatesByLocal(SceneObjectPart part, List<SceneObjectPartProperties> updatedProperties);
//The folloiwng calls deal with object updates, and will insert each update into an outgoing queue of each SyncConnector //The folloiwng calls deal with object updates, and will insert each update into an outgoing queue of each SyncConnector
void SendSceneUpdates(); void SendSceneUpdates();

View File

@ -3203,10 +3203,15 @@ namespace OpenSim.Region.Framework.Scenes
ClearUpdateSchedule(); ClearUpdateSchedule();
//SYMMETRIC SYNC //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) if (m_parentGroup.Scene.RegionSyncModule != null)
{ {
m_parentGroup.Scene.RegionSyncModule.QueueSceneObjectPartForUpdate((SceneObjectPart)this); m_parentGroup.Scene.RegionSyncModule.QueueSceneObjectPartForUpdate((SceneObjectPart)this);
} }
* */
//end of SYMMETRIC SYNC //end of SYMMETRIC SYNC
} }
@ -5937,6 +5942,9 @@ namespace OpenSim.Region.Framework.Scenes
return partUpdateResult; return partUpdateResult;
} }
//Implementation of ScheduleFullUpdate and ScheduleTerseUpdate for Bucket
//based synchronization
/*
public override void ScheduleFullUpdate(List<SceneObjectPartProperties> updatedProperties) public override void ScheduleFullUpdate(List<SceneObjectPartProperties> updatedProperties)
{ {
if (updatedProperties != null && updatedProperties.Count > 0) if (updatedProperties != null && updatedProperties.Count > 0)
@ -5964,6 +5972,36 @@ namespace OpenSim.Region.Framework.Scenes
base.ScheduleTerseUpdate(updatedProperties); base.ScheduleTerseUpdate(updatedProperties);
//TaintBucketSyncInfo(property); //TaintBucketSyncInfo(property);
} }
* */
//Implementation of ScheduleFullUpdate and ScheduleTerseUpdate for Bucket
//based synchronization
public override void ScheduleFullUpdate(List<SceneObjectPartProperties> 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<SceneObjectPartProperties> 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);
}
/// <summary> /// <summary>
/// Schedules this prim for a full update, without changing the timestamp or actorID (info on when and who modified any property). /// 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
/// </summary> /// </summary>
public void ScheduleFullUpdate_SyncInfoUnchanged() public void ScheduleFullUpdate_SyncInfoUnchanged()
{ {
//m_log.DebugFormat("[SCENE OBJECT PART]: ScheduleFullUpdate_SyncInfoUnchanged for {0} {1}", Name, LocalId); base.ScheduleFullUpdate(null);
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);
} }
private bool UpdateCollisionSound(UUID updatedCollisionSound) private bool UpdateCollisionSound(UUID updatedCollisionSound)