commit code which stops full updates being fired multiple times when attachments cross standalone region boundaries

lots of messy debug code here too which would need to be removed
0.6.9-post-fixes
Justin Clark-Casey (justincc) 2010-05-27 21:35:17 +01:00
parent a6c7995b71
commit 5074d290e4
10 changed files with 123 additions and 23 deletions

View File

@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
{ {
if (s.RegionInfo.RegionHandle == regionHandle) if (s.RegionInfo.RegionHandle == regionHandle)
{ {
//m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject");
if (isLocalCall) if (isLocalCall)
{ {
// We need to make a local copy of the object // We need to make a local copy of the object

View File

@ -2449,6 +2449,8 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
m_log.DebugFormat("[SCENE INVENTORY]: {0} {1} IsAttachment={2}", att.Name, att.LocalId, att.IsAttachment);
Console.WriteLine("HERE X");
ScenePresence presence; ScenePresence presence;
if (TryGetAvatar(remoteClient.AgentId, out presence)) if (TryGetAvatar(remoteClient.AgentId, out presence))
{ {
@ -2456,9 +2458,12 @@ namespace OpenSim.Region.Framework.Scenes
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item); item = InventoryService.GetItem(item);
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
Console.WriteLine("HERE Y");
if (m_AvatarFactory != null) if (m_AvatarFactory != null)
m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
Console.WriteLine("HERE Z");
} }
} }

View File

@ -124,6 +124,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (((SceneObjectGroup)ent).LocalId == primLocalID) if (((SceneObjectGroup)ent).LocalId == primLocalID)
{ {
m_log.DebugFormat("[SCENE]: Received full update request for {0} from {1}", primLocalID, remoteClient.Name);
((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient); ((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient);
return; return;
} }

View File

@ -1833,6 +1833,28 @@ namespace OpenSim.Region.Framework.Scenes
return sceneObject; return sceneObject;
} }
/// <summary>
/// Add an object into the scene that has come from storage
/// </summary>
///
/// <param name="sceneObject"></param>
/// <param name="attachToBackup">
/// If true, changes to the object will be reflected in its persisted data
/// If false, the persisted data will not be changed even if the object in the scene is changed
/// </param>
/// <param name="alreadyPersisted">
/// If true, we won't persist this object until it changes
/// If false, we'll persist this object immediately
/// </param>
/// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns>
public bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
{
return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates);
}
/// <summary> /// <summary>
/// Add an object into the scene that has come from storage /// Add an object into the scene that has come from storage
/// </summary> /// </summary>
@ -1852,7 +1874,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool AddRestoredSceneObject( public bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
{ {
return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted); return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true);
} }
/// <summary> /// <summary>
@ -2461,7 +2483,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns> /// <returns></returns>
public bool IncomingCreateObject(ISceneObject sog) public bool IncomingCreateObject(ISceneObject sog)
{ {
//m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
SceneObjectGroup newObject; SceneObjectGroup newObject;
try try
{ {
@ -2533,10 +2555,12 @@ namespace OpenSim.Region.Framework.Scenes
if (sceneObject.IsAttachmentCheckFull()) // Attachment if (sceneObject.IsAttachmentCheckFull()) // Attachment
{ {
m_log.DebugFormat("[SCENE]: Adding attachment {0} {1}", sceneObject.Name, sceneObject.LocalId);
sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
sceneObject.RootPart.AddFlag(PrimFlags.Phantom); sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
AddRestoredSceneObject(sceneObject, false, false); AddRestoredSceneObject(sceneObject, false, false, false);
// Handle attachment special case // Handle attachment special case
SceneObjectPart RootPrim = sceneObject.RootPart; SceneObjectPart RootPrim = sceneObject.RootPart;
@ -2544,6 +2568,8 @@ namespace OpenSim.Region.Framework.Scenes
// Fix up attachment Parent Local ID // Fix up attachment Parent Local ID
ScenePresence sp = GetScenePresence(sceneObject.OwnerID); ScenePresence sp = GetScenePresence(sceneObject.OwnerID);
Console.WriteLine("AAAA");
//uint parentLocalID = 0; //uint parentLocalID = 0;
if (sp != null) if (sp != null)
{ {
@ -2562,20 +2588,25 @@ namespace OpenSim.Region.Framework.Scenes
//grp.SetFromAssetID(grp.RootPart.LastOwnerID); //grp.SetFromAssetID(grp.RootPart.LastOwnerID);
m_log.DebugFormat( m_log.DebugFormat(
"[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
AttachObject( AttachObject(
sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
grp.SendGroupFullUpdate(); //grp.SendGroupFullUpdate();
} }
else else
{ {
RootPrim.RemFlag(PrimFlags.TemporaryOnRez); RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
RootPrim.AddFlag(PrimFlags.TemporaryOnRez); RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
} }
Console.WriteLine("BBBB");
} }
else else
{ {
m_log.DebugFormat("[SCENE]: Adding ordinary object {0} {1}", sceneObject.Name, sceneObject.LocalId);
AddRestoredSceneObject(sceneObject, true, false); AddRestoredSceneObject(sceneObject, true, false);
if (!Permissions.CanObjectEntry(sceneObject.UUID, if (!Permissions.CanObjectEntry(sceneObject.UUID,

View File

@ -1383,7 +1383,9 @@ namespace OpenSim.Region.Framework.Scenes
// now we have a child agent in this region. Request all interesting data about other (root) agents // now we have a child agent in this region. Request all interesting data about other (root) agents
agent.SendInitialFullUpdateToAllClients(); agent.SendInitialFullUpdateToAllClients();
Console.WriteLine("SCS 1");
agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true); agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true);
Console.WriteLine("SCS 2");
// m_scene.SendKillObject(m_localId); // m_scene.SendKillObject(m_localId);

View File

@ -216,11 +216,15 @@ namespace OpenSim.Region.Framework.Scenes
/// If true, we won't persist this object until it changes /// If true, we won't persist this object until it changes
/// If false, we'll persist this object immediately /// If false, we'll persist this object immediately
/// </param> /// </param>
/// <param name="sendClientUpdate">
/// If true, we send updates to the client to tell it about this object
/// If false, we leave it up to the caller to do this
/// </param>
/// <returns> /// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene /// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns> /// </returns>
protected internal bool AddRestoredSceneObject( protected internal bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
{ {
if (!alreadyPersisted) if (!alreadyPersisted)
{ {
@ -228,8 +232,29 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.HasGroupChanged = true; sceneObject.HasGroupChanged = true;
} }
return AddSceneObject(sceneObject, attachToBackup, true); return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
} }
// /// <summary>
// /// Add an object into the scene that has come from storage
// /// </summary>
// /// <param name="sceneObject"></param>
// /// <param name="attachToBackup">
// /// If true, changes to the object will be reflected in its persisted data
// /// If false, the persisted data will not be changed even if the object in the scene is changed
// /// </param>
// /// <param name="alreadyPersisted">
// /// If true, we won't persist this object until it changes
// /// If false, we'll persist this object immediately
// /// </param>
// /// <returns>
// /// true if the object was added, false if an object with the same uuid was already in the scene
// /// </returns>
// protected internal bool AddRestoredSceneObject(
// SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
// {
// AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true);
// }
/// <summary> /// <summary>
/// Add a newly created object to the scene. This will both update the scene, and send information about the /// Add a newly created object to the scene. This will both update the scene, and send information about the
@ -611,11 +636,13 @@ namespace OpenSim.Region.Framework.Scenes
protected internal bool AttachObject( protected internal bool AttachObject(
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
{ {
Console.WriteLine("HERE A");
SceneObjectGroup group = GetGroupByPrim(objectLocalID); SceneObjectGroup group = GetGroupByPrim(objectLocalID);
if (group != null) if (group != null)
{ {
if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId))
{ {
Console.WriteLine("HERE -1");
// If the attachment point isn't the same as the one previously used // If the attachment point isn't the same as the one previously used
// set it's offset position = 0 so that it appears on the attachment point // set it's offset position = 0 so that it appears on the attachment point
// and not in a weird location somewhere unknown. // and not in a weird location somewhere unknown.
@ -654,9 +681,12 @@ namespace OpenSim.Region.Framework.Scenes
itemId = group.GetFromItemID(); itemId = group.GetFromItemID();
} }
Console.WriteLine("HERE 0");
m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group); m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group);
Console.WriteLine("HERE 1");
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
Console.WriteLine("HERE 2");
// In case it is later dropped again, don't let // In case it is later dropped again, don't let
// it get cleaned up // it get cleaned up
// //

View File

@ -1494,6 +1494,10 @@ namespace OpenSim.Region.Framework.Scenes
public void SendFullUpdateToClient(IClientAPI remoteClient) public void SendFullUpdateToClient(IClientAPI remoteClient)
{ {
if (IsAttachment)
m_log.DebugFormat(
"[SOG]: Sending full update to client {0} for {1} {2}", remoteClient.Name, Name, LocalId);
SendPartFullUpdate(remoteClient, RootPart, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID)); SendPartFullUpdate(remoteClient, RootPart, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID));
lock (m_parts) lock (m_parts)
@ -1513,8 +1517,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="part"></param> /// <param name="part"></param>
internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags)
{ {
// m_log.DebugFormat( if (IsAttachment)
// "[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); m_log.DebugFormat(
"[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
if (m_rootPart.UUID == part.UUID) if (m_rootPart.UUID == part.UUID)
{ {
@ -1994,7 +1999,8 @@ namespace OpenSim.Region.Framework.Scenes
public void ScheduleFullUpdateToAvatar(ScenePresence presence) public void ScheduleFullUpdateToAvatar(ScenePresence presence)
{ {
// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1} just to avatar {2}", Name, UUID, presence.Name); if (IsAttachment)
m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1} just to avatar {2}", Name, UUID, presence.Name);
RootPart.AddFullUpdateToAvatar(presence); RootPart.AddFullUpdateToAvatar(presence);
@ -2026,7 +2032,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void ScheduleGroupForFullUpdate() public void ScheduleGroupForFullUpdate()
{ {
// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, UUID); if (IsAttachment)
m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, UUID);
checkAtTargets(); checkAtTargets();
RootPart.ScheduleFullUpdate(); RootPart.ScheduleFullUpdate();

View File

@ -1259,16 +1259,17 @@ namespace OpenSim.Region.Framework.Scenes
/// Tell all scene presences that they should send updates for this part to their clients /// Tell all scene presences that they should send updates for this part to their clients
/// </summary> /// </summary>
public void AddFullUpdateToAllAvatars() public void AddFullUpdateToAllAvatars()
{ {
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++) for (int i = 0; i < avatars.Length; i++)
{ AddFullUpdateToAvatar(avatars[i]);
avatars[i].SceneViewer.QueuePartForUpdate(this);
}
} }
public void AddFullUpdateToAvatar(ScenePresence presence) public void AddFullUpdateToAvatar(ScenePresence presence)
{ {
if (IsAttachment)
m_log.DebugFormat("AddFullUpdateToAllAvatar() {0} for {1} {2}", presence.Name, Name, LocalId);
presence.SceneViewer.QueuePartForUpdate(this); presence.SceneViewer.QueuePartForUpdate(this);
} }
@ -1287,13 +1288,14 @@ namespace OpenSim.Region.Framework.Scenes
{ {
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++) for (int i = 0; i < avatars.Length; i++)
{ AddTerseUpdateToAvatar(avatars[i]);
avatars[i].SceneViewer.QueuePartForUpdate(this);
}
} }
public void AddTerseUpdateToAvatar(ScenePresence presence) public void AddTerseUpdateToAvatar(ScenePresence presence)
{ {
if (IsAttachment)
m_log.DebugFormat("AddTerseUpdateToAvatar() {0} for {1} {2}", presence.Name, Name, LocalId);
presence.SceneViewer.QueuePartForUpdate(this); presence.SceneViewer.QueuePartForUpdate(this);
} }
@ -2727,7 +2729,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void ScheduleFullUpdate() public void ScheduleFullUpdate()
{ {
// m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); if (IsAttachment)
m_log.DebugFormat("[SOP]: Scheduling full update for {0} {1}", Name, LocalId);
if (m_parentGroup != null) if (m_parentGroup != null)
{ {
@ -2840,6 +2843,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags)
{ {
if (IsAttachment)
m_log.DebugFormat(
"[SCENE OBJECT PART]: Sending part full update to {0} for {1} {2}", remoteClient.Name, Name, LocalId);
m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags);
} }
@ -2848,6 +2855,10 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void SendFullUpdateToAllClients() public void SendFullUpdateToAllClients()
{ {
if (IsAttachment)
m_log.DebugFormat(
"[SCENE OBJECT PART]: Sending full update for {0} {1} for all clients", Name, LocalId);
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++) for (int i = 0; i < avatars.Length; i++)
{ {
@ -2859,6 +2870,10 @@ namespace OpenSim.Region.Framework.Scenes
public void SendFullUpdateToAllClientsExcept(UUID agentID) public void SendFullUpdateToAllClientsExcept(UUID agentID)
{ {
if (IsAttachment)
m_log.DebugFormat(
"[SCENE OBJECT PART]: Sending full update for {0} {1} to all clients except {2}", Name, LocalId, agentID);
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++) for (int i = 0; i < avatars.Length; i++)
{ {
@ -2965,6 +2980,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
{ {
if (IsAttachment)
m_log.DebugFormat("[SOP]: Sending scheduled full update for {0} {1}", Name, LocalId);
AddFullUpdateToAllAvatars(); AddFullUpdateToAllAvatars();
ClearUpdateSchedule(); ClearUpdateSchedule();
} }

View File

@ -27,6 +27,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection;
using OpenMetaverse; using OpenMetaverse;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
@ -39,6 +40,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
public class SceneViewer : ISceneViewer public class SceneViewer : ISceneViewer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected ScenePresence m_presence; protected ScenePresence m_presence;
protected UpdateQueue m_partsUpdateQueue = new UpdateQueue(); protected UpdateQueue m_partsUpdateQueue = new UpdateQueue();
protected Queue<SceneObjectGroup> m_pendingObjects; protected Queue<SceneObjectGroup> m_pendingObjects;
@ -60,6 +63,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="part"></param> /// <param name="part"></param>
public void QueuePartForUpdate(SceneObjectPart part) public void QueuePartForUpdate(SceneObjectPart part)
{ {
if (part.IsAttachment)
m_log.DebugFormat("[SCENE VIEWER]: Queueing part {0} {1} for update", part.Name, part.LocalId);
lock (m_partsUpdateQueue) lock (m_partsUpdateQueue)
{ {
m_partsUpdateQueue.Enqueue(part); m_partsUpdateQueue.Enqueue(part);
@ -134,7 +140,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
else if (update.LastTerseUpdateTime <= part.TimeStampTerse) else if (update.LastTerseUpdateTime <= part.TimeStampTerse)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(AddFullUpdateToAvatar
// "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}", // "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}",
// part.Name, part.UUID, part.TimeStampTerse); // part.Name, part.UUID, part.TimeStampTerse);

View File

@ -12,7 +12,7 @@
<log4net> <log4net>
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console"> <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{HH:mm:ss} - %message" /> <conversionPattern value="%date{HH:mm:ss,fff} - %message" />
</layout> </layout>
</appender> </appender>