Fixed code in handling setting attachedAvatar when its UUID.Zero.
Removed some obselete and debug code.dsg
parent
2f7ecf359b
commit
ab0630ed81
|
@ -567,8 +567,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
|
||||
{
|
||||
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE] Region {5}: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name,
|
||||
attachmentpoint, attachOffset, so.RootPart.AttachedPos, m_scene.RegionInfo.RegionName);
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name,
|
||||
attachmentpoint, attachOffset, so.RootPart.AttachedPos);
|
||||
|
||||
so.DetachFromBackup();
|
||||
|
||||
|
|
|
@ -511,10 +511,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
{
|
||||
m_log.ErrorFormat("{0} Caught exception in UpdatedAvatar handler (TrySetMovementAnimation): {1}", LogHeader(), e.Message);
|
||||
}
|
||||
/*
|
||||
string result = String.Format("Avatar \"{0}\" ({1}) ({2}) updated (pos:{3}, vel:{4}, rot:{5}, fly:{6})",
|
||||
presence.Name, presence.UUID.ToString(), presence.LocalId.ToString(),
|
||||
presence.AbsolutePosition.ToString(), presence.Velocity.ToString(),
|
||||
presence.Rotation.ToString(), presence.PhysicsActor.Flying ? "Y" : "N");
|
||||
* */
|
||||
// RegionSyncMessage.HandleSuccess(LogHeader(), msg, result);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -234,9 +234,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
//m_log.DebugFormat("[REGION SYNC SERVER MODULE] QueuePresenceForUpdate: {0}", presence.UUID.ToString());
|
||||
}
|
||||
|
||||
//DSG DEBUG
|
||||
private Vector3 lastPos;
|
||||
|
||||
public void SendUpdates()
|
||||
{
|
||||
if (!Active || !Synced)
|
||||
|
@ -300,14 +297,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
presence.lastSentParentID = presence.ParentID;
|
||||
}
|
||||
|
||||
//DSG DEBUG
|
||||
//Vector3 diff = presence.AbsolutePosition - lastPos;
|
||||
if (Vector3.Distance(presence.AbsolutePosition, lastPos) > 0.1)
|
||||
{
|
||||
m_log.DebugFormat("Sending UpdatedAvatar for avatar {0}, with new pos {1}", presence.Name, presence.AbsolutePosition);
|
||||
lastPos = presence.AbsolutePosition;
|
||||
}
|
||||
|
||||
RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.UpdatedAvatar, OSDParser.SerializeJsonString(data));
|
||||
m_server.EnqueuePresenceUpdate(presence.UUID, rsm.ToBytes());
|
||||
|
||||
|
|
|
@ -196,114 +196,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
get { return m_isSyncRelay; }
|
||||
}
|
||||
|
||||
private Dictionary<SceneObjectPartSyncProperties, string> m_primPropertyBucketMap = new Dictionary<SceneObjectPartSyncProperties, string>();
|
||||
public Dictionary<SceneObjectPartSyncProperties, string> PrimPropertyBucketMap
|
||||
{
|
||||
get { return m_primPropertyBucketMap; }
|
||||
}
|
||||
private List<string> m_propertyBucketNames = new List<string>();
|
||||
public List<string> PropertyBucketDescription
|
||||
{
|
||||
get { return m_propertyBucketNames; }
|
||||
}
|
||||
|
||||
public void QueueScenePresenceForTerseUpdate(ScenePresence presence)
|
||||
{
|
||||
lock (m_updateScenePresenceLock)
|
||||
{
|
||||
m_presenceUpdates[presence.UUID] = presence;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//SendSceneUpdates put each update into an outgoing queue of each SyncConnector
|
||||
/// <summary>
|
||||
/// Send updates to other sync nodes. So far we only handle object updates.
|
||||
/// </summary>
|
||||
public void SendSceneUpdates()
|
||||
{
|
||||
if (!IsSyncingWithOtherSyncNodes())
|
||||
{
|
||||
//no SyncConnector connected. clear update queues and return.
|
||||
foreach (string bucketName in m_propertyBucketNames)
|
||||
{
|
||||
m_primUpdates[bucketName].Clear();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Existing value of 1 indicates that updates are currently being sent so skip updates this pass
|
||||
if (Interlocked.Exchange(ref m_sendingUpdates, 1) == 1)
|
||||
{
|
||||
m_log.DebugFormat("[REGION SYNC MODULE] SendUpdates(): An update thread is already running.");
|
||||
return;
|
||||
}
|
||||
|
||||
Dictionary<string, List<SceneObjectPart>> primUpdates = new Dictionary<string,List<SceneObjectPart>>();
|
||||
|
||||
bool updated = false;
|
||||
//copy the updated SOG list and clear m_primUpdates for immediately future usage
|
||||
foreach (string bucketName in m_propertyBucketNames)
|
||||
{
|
||||
if (m_primUpdates[bucketName].Count > 0)
|
||||
{
|
||||
//m_log.DebugFormat(m_primUpdates[bucketName].Count + " to send {0} updated parts in bucket {1}", m_primUpdates[bucketName].Count, bucketName);
|
||||
|
||||
lock (m_primUpdateLocks[bucketName])
|
||||
{
|
||||
updated = true;
|
||||
//primUpdates.Add(bucketName, new List<SceneObjectPart>(m_primUpdates[bucketName].Values));
|
||||
|
||||
//copy the update list
|
||||
List<SceneObjectPart> updateList = new List<SceneObjectPart>();
|
||||
foreach (SceneObjectPart part in m_primUpdates[bucketName].Values)
|
||||
{
|
||||
if (!part.ParentGroup.IsDeleted)
|
||||
{
|
||||
//m_log.DebugFormat("include {0},{1} in update list", part.Name, part.UUID);
|
||||
updateList.Add(part);
|
||||
}
|
||||
}
|
||||
primUpdates.Add(bucketName, updateList);
|
||||
|
||||
m_primUpdates[bucketName].Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (updated)
|
||||
{
|
||||
long timeStamp = DateTime.Now.Ticks;
|
||||
|
||||
// This could be another thread for sending outgoing messages or just have the Queue functions
|
||||
// create and queue the messages directly into the outgoing server thread.
|
||||
System.Threading.ThreadPool.QueueUserWorkItem(delegate
|
||||
{
|
||||
// Dan's note: Sending the message when it's first queued would yield lower latency but much higher load on the simulator
|
||||
// as parts may be updated many many times very quickly. Need to implement a higher resolution send in heartbeat
|
||||
|
||||
foreach (string bucketName in m_propertyBucketNames)
|
||||
{
|
||||
if (primUpdates.ContainsKey(bucketName) && primUpdates[bucketName].Count > 0)
|
||||
{
|
||||
//m_log.Debug(LogHeader + " calling update sender for bucket " + bucketName);
|
||||
m_primUpdatesPerBucketSender[bucketName](bucketName, primUpdates[bucketName]);
|
||||
primUpdates[bucketName].Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Indicate that the current batch of updates has been completed
|
||||
Interlocked.Exchange(ref m_sendingUpdates, 0);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Interlocked.Exchange(ref m_sendingUpdates, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//The following Sendxxx calls,send out a message immediately, w/o putting it in the SyncConnector's outgoing queue.
|
||||
//May need some optimization there on the priorities.
|
||||
|
||||
|
@ -2654,12 +2546,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
//m_log.DebugFormat("{0}: SendPrimPropertyUpdates for {1}, {2}, with updated properties -- {3}", LogHeader, sop.Name, sop.UUID, pString);
|
||||
|
||||
//DSG DEBUG
|
||||
|
||||
if (updatedProperties.Contains(SceneObjectPartSyncProperties.AggregateScriptEvents))
|
||||
/*
|
||||
if (updatedProperties.Contains(SceneObjectPartSyncProperties.GroupPosition))
|
||||
{
|
||||
// m_log.DebugFormat("SendPrimPropertyUpdates -- AggregateScriptEvents: " + sop.AggregateScriptEvents);
|
||||
m_log.DebugFormat("SendPrimPropertyUpdates -- prim {0}: GroupPosition: {1} ", sop.Name, sop.GroupPosition);
|
||||
}
|
||||
|
||||
if (updatedProperties.Contains(SceneObjectPartSyncProperties.Position))
|
||||
{
|
||||
m_log.DebugFormat("SendPrimPropertyUpdates -- prim {0}: Position: {1} ", sop.Name, sop.PhysActor.Position);
|
||||
}
|
||||
* */
|
||||
|
||||
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedPrimProperties, OSDParser.SerializeJsonString(syncData));
|
||||
SendPrimUpdateToRelevantSyncConnectors(sop.UUID, syncMsg);
|
||||
|
@ -5553,29 +5449,37 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
if (!part.AttachedAvatar.Equals(attachedAvatar))
|
||||
{
|
||||
part.AttachedAvatar = attachedAvatar;
|
||||
Scene localScene = GetLocalScene();
|
||||
ScenePresence avatar = localScene.GetScenePresence(attachedAvatar);
|
||||
//It is possible that the avatar has not been fully
|
||||
//created locally when attachment objects are sync'ed.
|
||||
//So we need to check if the avatar already exists.
|
||||
//If not, handling of NewAvatar will evetually trigger
|
||||
//calling of SetParentLocalId.
|
||||
if (avatar != null)
|
||||
if (attachedAvatar != UUID.Zero)
|
||||
{
|
||||
if (part.ParentGroup != null)
|
||||
Scene localScene = GetLocalScene();
|
||||
ScenePresence avatar = localScene.GetScenePresence(attachedAvatar);
|
||||
//It is possible that the avatar has not been fully
|
||||
//created locally when attachment objects are sync'ed.
|
||||
//So we need to check if the avatar already exists.
|
||||
//If not, handling of NewAvatar will evetually trigger
|
||||
//calling of SetParentLocalId.
|
||||
if (avatar != null)
|
||||
{
|
||||
part.ParentGroup.RootPart.SetParentLocalId(avatar.LocalId);
|
||||
}
|
||||
else
|
||||
{
|
||||
//If this SOP is not a part of group yet, record the
|
||||
//avatar's localID for now. If this SOP is rootpart of
|
||||
//the group, then the localID is the right setting;
|
||||
//otherwise, this SOP will be linked to the SOG it belongs
|
||||
//to later, and that will rewrite the parent localID.
|
||||
part.SetParentLocalId(avatar.LocalId);
|
||||
if (part.ParentGroup != null)
|
||||
{
|
||||
part.ParentGroup.RootPart.SetParentLocalId(avatar.LocalId);
|
||||
}
|
||||
else
|
||||
{
|
||||
//If this SOP is not a part of group yet, record the
|
||||
//avatar's localID for now. If this SOP is rootpart of
|
||||
//the group, then the localID is the right setting;
|
||||
//otherwise, this SOP will be linked to the SOG it belongs
|
||||
//to later, and that will rewrite the parent localID.
|
||||
part.SetParentLocalId(avatar.LocalId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
part.SetParentLocalId(0);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case SceneObjectPartSyncProperties.AttachedPos:
|
||||
|
|
|
@ -57,41 +57,15 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
//DSGActorTypes DSGActorType { get; set; }
|
||||
bool IsSyncRelay { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The mapping of a property (identified by its name) to the index of a bucket.
|
||||
/// </summary>
|
||||
Dictionary<SceneObjectPartSyncProperties, string> PrimPropertyBucketMap { get; }
|
||||
/// <summary>
|
||||
/// The text description of the properties in each bucket, e.g. "General", "Physics"
|
||||
/// </summary>
|
||||
List<string> 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 ProcessAndEnqueuePrimUpdatesBySync(SceneObjectPart part, List<SceneObjectPartSyncProperties> updatedProperties);
|
||||
void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List<SceneObjectPartSyncProperties> updatedProperties);
|
||||
void SyncOutPrimUpdates();
|
||||
|
||||
//Legacy calls in Bucket sync'ing
|
||||
//The folloiwng calls deal with object updates, and will insert each update into an outgoing queue of each SyncConnector
|
||||
//void SendSceneUpdates();
|
||||
//void SendNewObject(SceneObjectGroup sog);
|
||||
//void SendDeleteObject(SceneObjectGroup sog, bool softDelete);
|
||||
//void SendLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List<SceneObjectPart> children);
|
||||
//void SendDeLinkObject(List<SceneObjectPart> prims, List<SceneObjectGroup> beforeDelinkGroups, List<SceneObjectGroup> afterDelinkGroups);
|
||||
|
||||
//New functions for per property sync'ing
|
||||
void SyncNewObject(SceneObjectGroup sog);
|
||||
void SyncDeleteObject(SceneObjectGroup sog, bool softDelete);
|
||||
void SyncLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List<SceneObjectPart> children);
|
||||
void SyncDeLinkObject(List<SceneObjectPart> prims, List<SceneObjectGroup> beforeDelinkGroups, List<SceneObjectGroup> afterDelinkGroups);
|
||||
|
||||
//In RegionSyncModule's implementation,
|
||||
//The following calls send out a message immediately, w/o putting it in the SyncConnector's outgoing queue.
|
||||
//May need some optimization there on the priorities.
|
||||
void SendTerrainUpdates(long updateTimeStamp, string lastUpdateActorID);
|
||||
//For propogating scene events to other actors
|
||||
void PublishSceneEvent(EventManager.EventNames ev, Object[] evArgs);
|
||||
|
@ -101,7 +75,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
//void QueuePresenceForTerseUpdate(ScenePresence presence)
|
||||
//void SendAvatarUpdates();
|
||||
|
||||
//Debug purpose, mainly for LSL scripts
|
||||
//Debug purpose, mainly for debugging properties updated by LSL scripts
|
||||
void Debug(String debugMsg);
|
||||
}
|
||||
|
||||
|
|
|
@ -3700,6 +3700,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_sceneGraph.RemoveScenePresence(agentID);
|
||||
m_clientManager.Remove(agentID);
|
||||
|
||||
//DSG
|
||||
// We need to keep track of this state in case this group is still queued for sync'ing.
|
||||
avatar.IsDeleted = true;
|
||||
//end of DSG
|
||||
|
||||
try
|
||||
{
|
||||
avatar.Close();
|
||||
|
|
|
@ -434,7 +434,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
//sceneObject.ScheduleGroupForFullUpdate();
|
||||
sceneObject.ScheduleGroupForFullUpdate(null);
|
||||
|
||||
//DSG SYNC: sending NewObject event, and sending it before calling ScheduleGroupForFullUpdate
|
||||
//DSG SYNC: sending NewObject event,
|
||||
if (m_parentScene.RegionSyncModule != null && triggerSyncNewObject)
|
||||
{
|
||||
m_parentScene.RegionSyncModule.SyncNewObject(sceneObject);
|
||||
|
|
|
@ -983,7 +983,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
AttachToBackup();
|
||||
m_scene.EventManager.TriggerParcelPrimCountTainted();
|
||||
//m_rootPart.ScheduleFullUpdate();
|
||||
m_rootPart.ScheduleFullUpdate(new List<SceneObjectPartSyncProperties>() { SceneObjectPartSyncProperties.GroupPosition, SceneObjectPartSyncProperties.AttachmentPoint}); //Physics properties, such as Position, OffsetPosition, etc, should be tainted in ApplyPhysics()
|
||||
m_rootPart.ScheduleFullUpdate(new List<SceneObjectPartSyncProperties>() { SceneObjectPartSyncProperties.GroupPosition, SceneObjectPartSyncProperties.AttachmentPoint,
|
||||
SceneObjectPartSyncProperties.AttachedAvatar, SceneObjectPartSyncProperties.Flags}); //Physics properties, such as Position, OffsetPosition, etc, should be tainted in ApplyPhysics()
|
||||
m_rootPart.ClearUndoState();
|
||||
}
|
||||
|
||||
|
|
|
@ -773,7 +773,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (IsAttachment)
|
||||
{
|
||||
if (m_parentGroup != null) //need to check this, it would be null while deserialization -- IsAttachment is now serialized
|
||||
if (m_parentGroup != null)
|
||||
{
|
||||
ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar);
|
||||
if (sp != null)
|
||||
|
|
|
@ -2938,9 +2938,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else if (neighbor > 0)
|
||||
{
|
||||
//DSG DEBUG
|
||||
m_log.DebugFormat("{0} now at pos {1}, calling CrossToNewRegion", Name);
|
||||
|
||||
if (!CrossToNewRegion())
|
||||
{
|
||||
if (m_requestedSitTargetUUID == UUID.Zero)
|
||||
|
|
Loading…
Reference in New Issue