Fix a race condition where an object update for a hud could be sent to non-owner avatars if the hud was attached directly from within the region.

If this happens, then the non-owners would see unremovable huds that they did not own until relog, and sometimes even beyond that.
This was due to a race between the entity update and the attachment code when moving an object from within scene to a hud.
0.7.4.1
Justin Clark-Casey (justincc) 2012-06-14 01:36:37 +01:00
parent a4290048e5
commit 917d753f1c
1 changed files with 24 additions and 3 deletions

View File

@ -3722,8 +3722,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
++updatesThisCall;
#region UpdateFlags to packet type conversion #region UpdateFlags to packet type conversion
PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
@ -3788,7 +3786,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
else else
{ {
updateBlock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, AgentId); SceneObjectPart part = (SceneObjectPart)update.Entity;
updateBlock = CreatePrimUpdateBlock(part, AgentId);
// If the part has become a private hud since the update was scheduled then we do not
// want to send it to other avatars.
if (part.ParentGroup.IsAttachment
&& part.ParentGroup.HasPrivateAttachmentPoint
&& part.ParentGroup.AttachedAvatar != AgentId)
continue;
} }
objectUpdateBlocks.Value.Add(updateBlock); objectUpdateBlocks.Value.Add(updateBlock);
@ -3811,6 +3817,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
// Everything else goes here // Everything else goes here
terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
if (update.Entity is SceneObjectPart)
{
SceneObjectPart part = (SceneObjectPart)update.Entity;
// If the part has become a private hud since the update was scheduled then we do not
// want to send it to other avatars.
if (part.ParentGroup.IsAttachment
&& part.ParentGroup.HasPrivateAttachmentPoint
&& part.ParentGroup.AttachedAvatar != AgentId)
continue;
}
terseUpdates.Value.Add(update); terseUpdates.Value.Add(update);
} }
} }
@ -3880,6 +3899,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// If any of the packets created from this call go unacknowledged, all of the updates will be resent // If any of the packets created from this call go unacknowledged, all of the updates will be resent
OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
} }
++updatesThisCall;
} }
#endregion Packet Sending #endregion Packet Sending