diff options
author | John Hurliman | 2009-10-18 03:15:36 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-18 03:15:36 -0700 |
commit | 1dbbf6edb6c913697ac3248ef5b74c943a7a9c23 (patch) | |
tree | 7a98fc3e6821358c228264bc07b769c9c58e1d30 /OpenSim/Region/ClientStack | |
parent | Zero out PrimitiveBaseShape.SculptData after the JPEG2000 data has been decod... (diff) | |
download | opensim-SC-1dbbf6edb6c913697ac3248ef5b74c943a7a9c23.zip opensim-SC-1dbbf6edb6c913697ac3248ef5b74c943a7a9c23.tar.gz opensim-SC-1dbbf6edb6c913697ac3248ef5b74c943a7a9c23.tar.bz2 opensim-SC-1dbbf6edb6c913697ac3248ef5b74c943a7a9c23.tar.xz |
* Process the avatar terse update priority queue as soon as an update for our own avatar is ready to send
* Reduce the scope of the locks when processing the update queues
* Reuse the ImprovedTerseObjectUpdate.RegionData block
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 79 |
1 files changed, 39 insertions, 40 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index b93e905..83a7184 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -3402,34 +3402,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3402 | 3402 | ||
3403 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = | 3403 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = |
3404 | CreateAvatarImprovedBlock(data.localID, data.position, data.velocity, rotation); | 3404 | CreateAvatarImprovedBlock(data.localID, data.position, data.velocity, rotation); |
3405 | 3405 | ||
3406 | lock (m_avatarTerseUpdates.SyncRoot) | 3406 | lock (m_avatarTerseUpdates.SyncRoot) |
3407 | m_avatarTerseUpdates.Enqueue(data.priority, terseBlock, data.localID); | 3407 | m_avatarTerseUpdates.Enqueue(data.priority, terseBlock, data.localID); |
3408 | |||
3409 | // If we received an update about our own avatar, process the avatar update priority queue immediately | ||
3410 | if (data.agentid == m_agentId) | ||
3411 | ProcessAvatarTerseUpdates(); | ||
3408 | } | 3412 | } |
3409 | 3413 | ||
3410 | private void ProcessAvatarTerseUpdates() | 3414 | private void ProcessAvatarTerseUpdates() |
3411 | { | 3415 | { |
3412 | lock (m_avatarTerseUpdates.SyncRoot) | 3416 | ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); |
3413 | { | 3417 | terse.Header.Reliable = false; |
3414 | ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); | 3418 | terse.Header.Zerocoded = true; |
3415 | 3419 | ||
3416 | terse.RegionData = new ImprovedTerseObjectUpdatePacket.RegionDataBlock(); | 3420 | //terse.RegionData = new ImprovedTerseObjectUpdatePacket.RegionDataBlock(); |
3417 | 3421 | terse.RegionData.RegionHandle = Scene.RegionInfo.RegionHandle; | |
3418 | terse.RegionData.RegionHandle = Scene.RegionInfo.RegionHandle; | 3422 | terse.RegionData.TimeDilation = (ushort)(Scene.TimeDilation * ushort.MaxValue); |
3419 | terse.RegionData.TimeDilation = | ||
3420 | (ushort)(Scene.TimeDilation * ushort.MaxValue); | ||
3421 | 3423 | ||
3424 | lock (m_avatarTerseUpdates.SyncRoot) | ||
3425 | { | ||
3422 | int count = Math.Min(m_avatarTerseUpdates.Count, m_avatarTerseUpdatesPerPacket); | 3426 | int count = Math.Min(m_avatarTerseUpdates.Count, m_avatarTerseUpdatesPerPacket); |
3427 | if (count == 0) | ||
3428 | return; | ||
3423 | 3429 | ||
3424 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[count]; | 3430 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[count]; |
3425 | for (int i = 0; i < count; i++) | 3431 | for (int i = 0; i < count; i++) |
3426 | terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); | 3432 | terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); |
3427 | |||
3428 | terse.Header.Reliable = false; | ||
3429 | terse.Header.Zerocoded = true; | ||
3430 | |||
3431 | OutPacket(terse, ThrottleOutPacketType.Task); | ||
3432 | } | 3433 | } |
3434 | |||
3435 | OutPacket(terse, ThrottleOutPacketType.Task); | ||
3433 | } | 3436 | } |
3434 | 3437 | ||
3435 | public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) | 3438 | public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) |
@@ -3642,26 +3645,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3642 | 3645 | ||
3643 | void ProcessPrimFullUpdates() | 3646 | void ProcessPrimFullUpdates() |
3644 | { | 3647 | { |
3645 | lock (m_primFullUpdates.SyncRoot) | 3648 | ObjectUpdatePacket outPacket = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
3646 | { | 3649 | outPacket.Header.Zerocoded = true; |
3647 | ObjectUpdatePacket outPacket = | ||
3648 | (ObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
3649 | PacketType.ObjectUpdate); | ||
3650 | 3650 | ||
3651 | outPacket.RegionData.RegionHandle = | 3651 | //outPacket.RegionData = new ObjectUpdatePacket.RegionDataBlock(); |
3652 | Scene.RegionInfo.RegionHandle; | 3652 | outPacket.RegionData.RegionHandle = Scene.RegionInfo.RegionHandle; |
3653 | outPacket.RegionData.TimeDilation = | 3653 | outPacket.RegionData.TimeDilation = (ushort)(Scene.TimeDilation * ushort.MaxValue); |
3654 | (ushort)(Scene.TimeDilation * ushort.MaxValue); | ||
3655 | 3654 | ||
3655 | lock (m_primFullUpdates.SyncRoot) | ||
3656 | { | ||
3656 | int count = Math.Min(m_primFullUpdates.Count, m_primFullUpdatesPerPacket); | 3657 | int count = Math.Min(m_primFullUpdates.Count, m_primFullUpdatesPerPacket); |
3658 | if (count == 0) | ||
3659 | return; | ||
3657 | 3660 | ||
3658 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[count]; | 3661 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[count]; |
3659 | for (int i = 0; i < count; i++) | 3662 | for (int i = 0; i < count; i++) |
3660 | outPacket.ObjectData[i] = m_primFullUpdates.Dequeue(); | 3663 | outPacket.ObjectData[i] = m_primFullUpdates.Dequeue(); |
3661 | |||
3662 | outPacket.Header.Zerocoded = true; | ||
3663 | OutPacket(outPacket, ThrottleOutPacketType.State); | ||
3664 | } | 3664 | } |
3665 | |||
3666 | OutPacket(outPacket, ThrottleOutPacketType.State); | ||
3665 | } | 3667 | } |
3666 | 3668 | ||
3667 | /// <summary> | 3669 | /// <summary> |
@@ -3695,28 +3697,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3695 | 3697 | ||
3696 | void ProcessPrimTerseUpdates() | 3698 | void ProcessPrimTerseUpdates() |
3697 | { | 3699 | { |
3698 | lock (m_primTerseUpdates.SyncRoot) | 3700 | ImprovedTerseObjectUpdatePacket outPacket = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); |
3699 | { | 3701 | outPacket.Header.Reliable = false; |
3700 | ImprovedTerseObjectUpdatePacket outPacket = | 3702 | outPacket.Header.Zerocoded = true; |
3701 | (ImprovedTerseObjectUpdatePacket) | ||
3702 | PacketPool.Instance.GetPacket( | ||
3703 | PacketType.ImprovedTerseObjectUpdate); | ||
3704 | 3703 | ||
3705 | outPacket.RegionData.RegionHandle = | 3704 | outPacket.RegionData.RegionHandle = Scene.RegionInfo.RegionHandle; |
3706 | Scene.RegionInfo.RegionHandle; | 3705 | outPacket.RegionData.TimeDilation = (ushort)(Scene.TimeDilation * ushort.MaxValue); |
3707 | outPacket.RegionData.TimeDilation = | ||
3708 | (ushort)(Scene.TimeDilation * ushort.MaxValue); | ||
3709 | 3706 | ||
3707 | lock (m_primTerseUpdates.SyncRoot) | ||
3708 | { | ||
3710 | int count = Math.Min(m_primTerseUpdates.Count, m_primTerseUpdatesPerPacket); | 3709 | int count = Math.Min(m_primTerseUpdates.Count, m_primTerseUpdatesPerPacket); |
3710 | if (count == 0) | ||
3711 | return; | ||
3711 | 3712 | ||
3712 | outPacket.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[count]; | 3713 | outPacket.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[count]; |
3713 | for (int i = 0; i < count; i++) | 3714 | for (int i = 0; i < count; i++) |
3714 | outPacket.ObjectData[i] = m_primTerseUpdates.Dequeue(); | 3715 | outPacket.ObjectData[i] = m_primTerseUpdates.Dequeue(); |
3715 | |||
3716 | outPacket.Header.Reliable = false; | ||
3717 | outPacket.Header.Zerocoded = true; | ||
3718 | OutPacket(outPacket, ThrottleOutPacketType.State); | ||
3719 | } | 3716 | } |
3717 | |||
3718 | OutPacket(outPacket, ThrottleOutPacketType.State); | ||
3720 | } | 3719 | } |
3721 | 3720 | ||
3722 | public void ReprioritizeUpdates(StateUpdateTypes type, UpdatePriorityHandler handler) | 3721 | public void ReprioritizeUpdates(StateUpdateTypes type, UpdatePriorityHandler handler) |