A stab at mantis #5256. Separate ScenePresence updates from SceneObject updates, and place them in different queues.
parent
cefdee8aaf
commit
f84905e294
|
@ -3553,111 +3553,116 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
|
OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
|
||||||
OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
|
OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
|
||||||
OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
|
OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
|
||||||
|
OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
|
||||||
|
|
||||||
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
|
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
|
||||||
int updatesThisCall = 0;
|
int updatesThisCall = 0;
|
||||||
|
|
||||||
lock (m_entityUpdates.SyncRoot)
|
EntityUpdate update;
|
||||||
|
while (updatesThisCall < maxUpdates)
|
||||||
{
|
{
|
||||||
EntityUpdate update;
|
lock (m_entityUpdates.SyncRoot)
|
||||||
while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update))
|
|
||||||
{
|
{
|
||||||
if (update.Entity is SceneObjectPart)
|
if (!m_entityUpdates.TryDequeue(out update))
|
||||||
{
|
break;
|
||||||
SceneObjectPart part = (SceneObjectPart)update.Entity;
|
}
|
||||||
|
|
||||||
// Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
|
if (update.Entity is SceneObjectPart)
|
||||||
// will never receive an update after a prim kill. Even then, keeping the kill record may be a good
|
{
|
||||||
// safety measure.
|
SceneObjectPart part = (SceneObjectPart)update.Entity;
|
||||||
//
|
|
||||||
// If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
|
// Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
|
||||||
// after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
|
// will never receive an update after a prim kill. Even then, keeping the kill record may be a good
|
||||||
// updates and kills on different threads with different scheduling strategies, hence this protection.
|
// safety measure.
|
||||||
//
|
//
|
||||||
// This doesn't appear to apply to child prims - a client will happily ignore these updates
|
// If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
|
||||||
// after the root prim has been deleted.
|
// after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
|
||||||
if (m_killRecord.Contains(part.LocalId))
|
// updates and kills on different threads with different scheduling strategies, hence this protection.
|
||||||
{
|
//
|
||||||
// m_log.WarnFormat(
|
// This doesn't appear to apply to child prims - a client will happily ignore these updates
|
||||||
// "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted",
|
// after the root prim has been deleted.
|
||||||
// part.LocalId, Name);
|
if (m_killRecord.Contains(part.LocalId))
|
||||||
continue;
|
{
|
||||||
}
|
// m_log.WarnFormat(
|
||||||
|
// "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted",
|
||||||
|
// part.LocalId, Name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (part.ParentGroup.IsAttachment && m_disableFacelights)
|
if (part.ParentGroup.IsAttachment && m_disableFacelights)
|
||||||
|
{
|
||||||
|
if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
|
||||||
|
part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
|
||||||
{
|
{
|
||||||
if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
|
part.Shape.LightEntry = false;
|
||||||
part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
|
|
||||||
{
|
|
||||||
part.Shape.LightEntry = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
++updatesThisCall;
|
++updatesThisCall;
|
||||||
|
|
||||||
#region UpdateFlags to packet type conversion
|
#region UpdateFlags to packet type conversion
|
||||||
|
|
||||||
PrimUpdateFlags updateFlags = update.Flags;
|
PrimUpdateFlags updateFlags = update.Flags;
|
||||||
|
|
||||||
bool canUseCompressed = true;
|
bool canUseCompressed = true;
|
||||||
bool canUseImproved = true;
|
bool canUseImproved = true;
|
||||||
|
|
||||||
// Compressed object updates only make sense for LL primitives
|
// Compressed object updates only make sense for LL primitives
|
||||||
if (!(update.Entity is SceneObjectPart))
|
if (!(update.Entity is SceneObjectPart))
|
||||||
|
{
|
||||||
|
canUseCompressed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
|
||||||
|
{
|
||||||
|
canUseCompressed = false;
|
||||||
|
canUseImproved = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.Joint))
|
||||||
{
|
{
|
||||||
canUseCompressed = false;
|
canUseCompressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
|
if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.Text) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.Material) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
|
||||||
|
updateFlags.HasFlag(PrimUpdateFlags.Joint))
|
||||||
{
|
{
|
||||||
canUseCompressed = false;
|
|
||||||
canUseImproved = false;
|
canUseImproved = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion UpdateFlags to packet type conversion
|
||||||
|
|
||||||
|
#region Block Construction
|
||||||
|
|
||||||
|
// TODO: Remove this once we can build compressed updates
|
||||||
|
canUseCompressed = false;
|
||||||
|
|
||||||
|
if (!canUseImproved && !canUseCompressed)
|
||||||
|
{
|
||||||
|
if (update.Entity is ScenePresence)
|
||||||
|
{
|
||||||
|
objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.Joint))
|
|
||||||
{
|
|
||||||
canUseCompressed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.Text) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.Material) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
|
|
||||||
updateFlags.HasFlag(PrimUpdateFlags.Joint))
|
|
||||||
{
|
|
||||||
canUseImproved = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion UpdateFlags to packet type conversion
|
|
||||||
|
|
||||||
#region Block Construction
|
|
||||||
|
|
||||||
// TODO: Remove this once we can build compressed updates
|
|
||||||
canUseCompressed = false;
|
|
||||||
|
|
||||||
if (!canUseImproved && !canUseCompressed)
|
|
||||||
{
|
|
||||||
if (update.Entity is ScenePresence)
|
|
||||||
{
|
|
||||||
objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment)
|
// if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment)
|
||||||
// {
|
// {
|
||||||
// SceneObjectPart sop = (SceneObjectPart)update.Entity;
|
// SceneObjectPart sop = (SceneObjectPart)update.Entity;
|
||||||
|
@ -3686,71 +3691,88 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
|
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
|
||||||
// }
|
// }
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!canUseImproved)
|
|
||||||
{
|
|
||||||
compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags));
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (!canUseImproved)
|
||||||
|
{
|
||||||
|
compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (update.Entity is ScenePresence)
|
||||||
|
terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
|
||||||
else
|
else
|
||||||
{
|
|
||||||
terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
|
terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Block Construction
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Packet Sending
|
#endregion Block Construction
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Packet Sending
|
||||||
|
|
||||||
const float TIME_DILATION = 1.0f;
|
const float TIME_DILATION = 1.0f;
|
||||||
ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f);
|
ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
if (terseAgentUpdateBlocks.IsValueCreated)
|
||||||
|
{
|
||||||
|
List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
|
||||||
|
|
||||||
|
ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
|
||||||
|
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
||||||
|
packet.RegionData.TimeDilation = timeDilation;
|
||||||
|
packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
|
||||||
|
|
||||||
|
for (int i = 0; i < blocks.Count; i++)
|
||||||
|
packet.ObjectData[i] = blocks[i];
|
||||||
|
|
||||||
|
OutPacket(packet, ThrottleOutPacketType.State, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (terseUpdateBlocks.IsValueCreated)
|
||||||
|
{
|
||||||
|
List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
|
||||||
|
|
||||||
|
ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
|
||||||
|
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
||||||
|
packet.RegionData.TimeDilation = timeDilation;
|
||||||
|
packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
|
||||||
|
|
||||||
|
for (int i = 0; i < blocks.Count; i++)
|
||||||
|
packet.ObjectData[i] = blocks[i];
|
||||||
|
|
||||||
|
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (objectUpdateBlocks.IsValueCreated)
|
||||||
|
{
|
||||||
|
List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
|
||||||
|
|
||||||
if (objectUpdateBlocks.IsValueCreated)
|
ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
|
||||||
{
|
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
||||||
List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
|
packet.RegionData.TimeDilation = timeDilation;
|
||||||
|
packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
|
||||||
|
|
||||||
ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
|
for (int i = 0; i < blocks.Count; i++)
|
||||||
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
packet.ObjectData[i] = blocks[i];
|
||||||
packet.RegionData.TimeDilation = timeDilation;
|
|
||||||
packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
|
|
||||||
|
|
||||||
for (int i = 0; i < blocks.Count; i++)
|
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
||||||
packet.ObjectData[i] = blocks[i];
|
}
|
||||||
|
|
||||||
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
if (compressedUpdateBlocks.IsValueCreated)
|
||||||
}
|
{
|
||||||
|
List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
|
||||||
|
|
||||||
if (compressedUpdateBlocks.IsValueCreated)
|
ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
|
||||||
{
|
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
||||||
List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
|
packet.RegionData.TimeDilation = timeDilation;
|
||||||
|
packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
|
||||||
|
|
||||||
ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
|
for (int i = 0; i < blocks.Count; i++)
|
||||||
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
packet.ObjectData[i] = blocks[i];
|
||||||
packet.RegionData.TimeDilation = timeDilation;
|
|
||||||
packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
|
|
||||||
|
|
||||||
for (int i = 0; i < blocks.Count; i++)
|
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
||||||
packet.ObjectData[i] = blocks[i];
|
|
||||||
|
|
||||||
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (terseUpdateBlocks.IsValueCreated)
|
|
||||||
{
|
|
||||||
List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
|
|
||||||
|
|
||||||
ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
|
|
||||||
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
|
||||||
packet.RegionData.TimeDilation = timeDilation;
|
|
||||||
packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
|
|
||||||
|
|
||||||
for (int i = 0; i < blocks.Count; i++)
|
|
||||||
packet.ObjectData[i] = blocks[i];
|
|
||||||
|
|
||||||
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Packet Sending
|
#endregion Packet Sending
|
||||||
|
|
Loading…
Reference in New Issue