diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index fa7a8475b6..2415791a98 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3436,12 +3436,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId); } - private void ProcessEntityUpdates() + private void ProcessEntityUpdates(int maxUpdates) { Lazy> objectUpdateBlocks = new Lazy>(); Lazy> compressedUpdateBlocks = new Lazy>(); Lazy> terseUpdateBlocks = new Lazy>(); + int updatesThisCall = 0; + lock (m_entityUpdates.SyncRoot) { EntityUpdate update; @@ -3516,50 +3518,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - bool avatar = (update.Entity is ScenePresence); - uint localID = update.Entity.LocalId; - uint attachPoint; - Vector4 collisionPlane; - Vector3 position, velocity, acceleration, angularVelocity; - Quaternion rotation; - byte[] textureEntry; - - if (update.Entity is ScenePresence) - { - ScenePresence presence = (ScenePresence)update.Entity; - - attachPoint = 0; - collisionPlane = presence.CollisionPlane; - position = presence.OffsetPosition; - velocity = presence.Velocity; - acceleration = Vector3.Zero; - angularVelocity = Vector3.Zero; - rotation = presence.Rotation; - - if (updateFlags.HasFlag(PrimUpdateFlags.Textures)) - textureEntry = presence.Appearance.Texture.GetBytes(); - else - textureEntry = null; - } - else - { - SceneObjectPart part = (SceneObjectPart)update.Entity; - - attachPoint = part.AttachmentPoint; - collisionPlane = Vector4.Zero; - position = part.RelativePosition; - velocity = part.Velocity; - acceleration = part.Acceleration; - angularVelocity = part.AngularVelocity; - rotation = part.RotationOffset; - textureEntry = part.Shape.TextureEntry; - } - - terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(avatar, localID, attachPoint, collisionPlane, position, - velocity, acceleration, rotation, angularVelocity, textureEntry)); + terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); } #endregion Block Construction + + ++updatesThisCall; + if (maxUpdates > 0 && updatesThisCall >= maxUpdates) + break; } } @@ -3618,6 +3584,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void ReprioritizeUpdates(UpdatePriorityHandler handler) { + //m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName); + PriorityQueue.UpdatePriorityHandler update_priority_handler = delegate(ref double priority, uint local_id) { @@ -3631,8 +3599,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void FlushPrimUpdates() { + m_log.Debug("[CLIENT]: Flushing prim updates to " + m_firstName + " " + m_lastName); + while (m_entityUpdates.Count > 0) - ProcessEntityUpdates(); + ProcessEntityUpdates(-1); } #endregion Primitive Packet/Data Sending Methods @@ -3665,11 +3635,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if ((categories & ThrottleOutPacketTypeFlags.State) != 0) { - lock (m_entityUpdates.SyncRoot) - { - if (m_entityUpdates.Count > 0) - ProcessEntityUpdates(); - } + if (m_entityUpdates.Count > 0) + ProcessEntityUpdates(m_udpServer.PrimUpdatesPerCallback); } if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0) @@ -4327,10 +4294,51 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Helper Methods - protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(bool avatar, uint localID, uint attachPoint, - Vector4 collisionPlane, Vector3 position, Vector3 velocity, Vector3 acceleration, Quaternion rotation, - Vector3 angularVelocity, byte[] textureEntry) + protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(ISceneEntity entity, bool sendTexture) { + #region ScenePresence/SOP Handling + + bool avatar = (entity is ScenePresence); + uint localID = entity.LocalId; + uint attachPoint; + Vector4 collisionPlane; + Vector3 position, velocity, acceleration, angularVelocity; + Quaternion rotation; + byte[] textureEntry; + + if (entity is ScenePresence) + { + ScenePresence presence = (ScenePresence)entity; + + attachPoint = 0; + collisionPlane = presence.CollisionPlane; + position = presence.OffsetPosition; + velocity = presence.Velocity; + acceleration = Vector3.Zero; + angularVelocity = Vector3.Zero; + rotation = presence.Rotation; + + if (sendTexture) + textureEntry = presence.Appearance.Texture.GetBytes(); + else + textureEntry = null; + } + else + { + SceneObjectPart part = (SceneObjectPart)entity; + + attachPoint = part.AttachmentPoint; + collisionPlane = Vector4.Zero; + position = part.RelativePosition; + velocity = part.Velocity; + acceleration = part.Acceleration; + angularVelocity = part.AngularVelocity; + rotation = part.RotationOffset; + textureEntry = part.Shape.TextureEntry; + } + + #endregion ScenePresence/SOP Handling + int pos = 0; byte[] data = new byte[(avatar ? 60 : 44)]; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 41e41e47a7..1b81105248 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -99,15 +99,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// The measured resolution of Environment.TickCount public readonly float TickCountResolution; - /// Number of terse prim updates to put on the queue each time the + /// Number of prim updates to put on the queue each time the /// OnQueueEmpty event is triggered for updates - public readonly int PrimTerseUpdatesPerPacket; - /// Number of terse avatar updates to put on the queue each time the - /// OnQueueEmpty event is triggered for updates - public readonly int AvatarTerseUpdatesPerPacket; - /// Number of full prim updates to put on the queue each time the - /// OnQueueEmpty event is triggered for updates - public readonly int PrimFullUpdatesPerPacket; + public readonly int PrimUpdatesPerCallback; /// Number of texture packets to put on the queue each time the /// OnQueueEmpty event is triggered for textures public readonly int TextureSendLimit; @@ -191,9 +185,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_recvBufferSize = config.GetInt("client_socket_rcvbuf_size", 0); sceneThrottleBps = config.GetInt("scene_throttle_max_bps", 0); - PrimTerseUpdatesPerPacket = config.GetInt("PrimTerseUpdatesPerPacket", 25); - AvatarTerseUpdatesPerPacket = config.GetInt("AvatarTerseUpdatesPerPacket", 10); - PrimFullUpdatesPerPacket = config.GetInt("PrimFullUpdatesPerPacket", 100); + PrimUpdatesPerCallback = config.GetInt("PrimUpdatesPerCallback", 100); TextureSendLimit = config.GetInt("TextureSendLimit", 20); m_defaultRTO = config.GetInt("DefaultRTO", 0); @@ -201,9 +193,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - PrimTerseUpdatesPerPacket = 25; - AvatarTerseUpdatesPerPacket = 10; - PrimFullUpdatesPerPacket = 100; + PrimUpdatesPerCallback = 100; TextureSendLimit = 20; } diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index f49cd975f1..3c2983b91f 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -369,18 +369,13 @@ ;asset_limit = 27500 ;state_limit = 37000 - ; Configures how ObjectUpdates are aggregated. These numbers - ; do not literally mean how many updates will be put in each - ; packet that goes over the wire, as packets are - ; automatically split on a 1400 byte boundary. These control - ; the balance between responsiveness of interest list updates - ; and total throughput. Higher numbers will ensure more full- - ; sized packets and faster sending of data, but more delay in - ; updating interest lists + ; Configures how scene graph updates are sent to clients. + ; This controls the balance between responsiveness of interest + ; list updates and total throughput. A higher value will ensure + ; more full-sized packets and faster sending of data, but more + ; delay in updating client interest lists ; - ;PrimTerseUpdatesPerPacket = 25 - ;AvatarTerseUpdatesPerPacket = 10 - ;PrimFullUpdatesPerPacket = 100 + PrimUpdatesPerCallback = 100 ; TextureSendLimit determines how many packets will be put on ; the outgoing queue each cycle. Like the settings above, this