diff options
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 116 |
1 files changed, 69 insertions, 47 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 84e705a..60dab5f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -3546,6 +3546,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3546 | objectData.TextureAnim = textureanim; | 3546 | objectData.TextureAnim = textureanim; |
3547 | } | 3547 | } |
3548 | 3548 | ||
3549 | bool doUpdate = false; | ||
3549 | lock (m_primFullUpdates) | 3550 | lock (m_primFullUpdates) |
3550 | { | 3551 | { |
3551 | if (m_primFullUpdates.Count == 0) | 3552 | if (m_primFullUpdates.Count == 0) |
@@ -3554,8 +3555,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3554 | m_primFullUpdates.Add(objectData); | 3555 | m_primFullUpdates.Add(objectData); |
3555 | 3556 | ||
3556 | if (m_primFullUpdates.Count >= m_primFullUpdatesPerPacket) | 3557 | if (m_primFullUpdates.Count >= m_primFullUpdatesPerPacket) |
3557 | ProcessPrimFullUpdates(this, null); | 3558 | doUpdate = true; |
3558 | } | 3559 | } |
3560 | if (doUpdate) | ||
3561 | ProcessPrimFullUpdates(this, null); | ||
3559 | } | 3562 | } |
3560 | 3563 | ||
3561 | void HandleQueueEmpty(ThrottleOutPacketType queue) | 3564 | void HandleQueueEmpty(ThrottleOutPacketType queue) |
@@ -3576,35 +3579,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3576 | 3579 | ||
3577 | void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e) | 3580 | void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e) |
3578 | { | 3581 | { |
3582 | bool stopTimer = false; | ||
3579 | lock (m_primFullUpdates) | 3583 | lock (m_primFullUpdates) |
3580 | { | 3584 | { |
3581 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) | 3585 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) |
3582 | { | 3586 | stopTimer = true; |
3583 | lock (m_primFullUpdateTimer) | 3587 | } |
3584 | m_primFullUpdateTimer.Stop(); | 3588 | if (stopTimer) |
3585 | 3589 | { | |
3586 | return; | 3590 | lock (m_primFullUpdateTimer) |
3587 | } | 3591 | m_primFullUpdateTimer.Stop(); |
3592 | return; | ||
3593 | } | ||
3588 | 3594 | ||
3589 | ObjectUpdatePacket outPacket = | 3595 | ObjectUpdatePacket outPacket = |
3590 | (ObjectUpdatePacket)PacketPool.Instance.GetPacket( | 3596 | (ObjectUpdatePacket)PacketPool.Instance.GetPacket( |
3591 | PacketType.ObjectUpdate); | 3597 | PacketType.ObjectUpdate); |
3592 | 3598 | ||
3593 | outPacket.RegionData.RegionHandle = | 3599 | outPacket.RegionData.RegionHandle = |
3594 | Scene.RegionInfo.RegionHandle; | 3600 | Scene.RegionInfo.RegionHandle; |
3595 | outPacket.RegionData.TimeDilation = | 3601 | outPacket.RegionData.TimeDilation = |
3596 | (ushort)(Scene.TimeDilation * ushort.MaxValue); | 3602 | (ushort)(Scene.TimeDilation * ushort.MaxValue); |
3597 | 3603 | ||
3598 | int max = m_primFullUpdates.Count; | 3604 | int max = m_primFullUpdates.Count; |
3599 | if (max > m_primFullUpdatesPerPacket) | 3605 | if (max > m_primFullUpdatesPerPacket) |
3600 | max = m_primFullUpdatesPerPacket; | 3606 | max = m_primFullUpdatesPerPacket; |
3601 | 3607 | ||
3602 | int count = 0; | 3608 | int count = 0; |
3603 | int size = 0; | 3609 | int size = 0; |
3604 | 3610 | ||
3605 | byte[] zerobuffer = new byte[1024]; | 3611 | byte[] zerobuffer = new byte[1024]; |
3606 | byte[] blockbuffer = new byte[1024]; | 3612 | byte[] blockbuffer = new byte[1024]; |
3607 | 3613 | ||
3614 | lock (m_primFullUpdates) | ||
3615 | { | ||
3608 | for (count = 0 ; count < max ; count++) | 3616 | for (count = 0 ; count < max ; count++) |
3609 | { | 3617 | { |
3610 | int length = 0; | 3618 | int length = 0; |
@@ -3628,9 +3636,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3628 | OutPacket(outPacket, ThrottleOutPacketType.Task); | 3636 | OutPacket(outPacket, ThrottleOutPacketType.Task); |
3629 | 3637 | ||
3630 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) | 3638 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) |
3631 | lock (m_primFullUpdateTimer) | 3639 | stopTimer = true; |
3632 | m_primFullUpdateTimer.Stop(); | ||
3633 | } | 3640 | } |
3641 | |||
3642 | if (stopTimer) | ||
3643 | lock (m_primFullUpdateTimer) | ||
3644 | m_primFullUpdateTimer.Stop(); | ||
3634 | } | 3645 | } |
3635 | 3646 | ||
3636 | /// <summary> | 3647 | /// <summary> |
@@ -3649,6 +3660,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3649 | CreatePrimImprovedBlock(localID, position, rotation, | 3660 | CreatePrimImprovedBlock(localID, position, rotation, |
3650 | velocity, rotationalvelocity, state); | 3661 | velocity, rotationalvelocity, state); |
3651 | 3662 | ||
3663 | bool doUpdate = false; | ||
3652 | lock (m_primTerseUpdates) | 3664 | lock (m_primTerseUpdates) |
3653 | { | 3665 | { |
3654 | if (m_primTerseUpdates.Count == 0) | 3666 | if (m_primTerseUpdates.Count == 0) |
@@ -3657,43 +3669,51 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3657 | m_primTerseUpdates.Add(objectData); | 3669 | m_primTerseUpdates.Add(objectData); |
3658 | 3670 | ||
3659 | if (m_primTerseUpdates.Count >= m_primTerseUpdatesPerPacket) | 3671 | if (m_primTerseUpdates.Count >= m_primTerseUpdatesPerPacket) |
3660 | ProcessPrimTerseUpdates(this, null); | 3672 | doUpdate = true; |
3661 | } | 3673 | } |
3674 | if (doUpdate) | ||
3675 | ProcessPrimTerseUpdates(this, null); | ||
3662 | } | 3676 | } |
3663 | 3677 | ||
3664 | void ProcessPrimTerseUpdates(object sender, ElapsedEventArgs e) | 3678 | void ProcessPrimTerseUpdates(object sender, ElapsedEventArgs e) |
3665 | { | 3679 | { |
3680 | bool stopTimer = false; | ||
3666 | lock (m_primTerseUpdates) | 3681 | lock (m_primTerseUpdates) |
3667 | { | 3682 | { |
3668 | if (m_primTerseUpdates.Count == 0) | 3683 | if (m_primTerseUpdates.Count == 0) |
3669 | { | 3684 | stopTimer = true; |
3670 | lock (m_primTerseUpdateTimer) | 3685 | } |
3671 | m_primTerseUpdateTimer.Stop(); | 3686 | if (stopTimer) |
3687 | { | ||
3688 | lock (m_primTerseUpdateTimer) | ||
3689 | m_primTerseUpdateTimer.Stop(); | ||
3672 | 3690 | ||
3673 | return; | 3691 | return; |
3674 | } | 3692 | } |
3675 | 3693 | ||
3676 | ImprovedTerseObjectUpdatePacket outPacket = | 3694 | ImprovedTerseObjectUpdatePacket outPacket = |
3677 | (ImprovedTerseObjectUpdatePacket) | 3695 | (ImprovedTerseObjectUpdatePacket) |
3678 | PacketPool.Instance.GetPacket( | 3696 | PacketPool.Instance.GetPacket( |
3679 | PacketType.ImprovedTerseObjectUpdate); | 3697 | PacketType.ImprovedTerseObjectUpdate); |
3680 | 3698 | ||
3681 | outPacket.RegionData.RegionHandle = | 3699 | outPacket.RegionData.RegionHandle = |
3682 | Scene.RegionInfo.RegionHandle; | 3700 | Scene.RegionInfo.RegionHandle; |
3683 | outPacket.RegionData.TimeDilation = | 3701 | outPacket.RegionData.TimeDilation = |
3684 | (ushort)(Scene.TimeDilation * ushort.MaxValue); | 3702 | (ushort)(Scene.TimeDilation * ushort.MaxValue); |
3685 | 3703 | ||
3686 | int max = m_primTerseUpdates.Count; | 3704 | int max = m_primTerseUpdates.Count; |
3687 | if (max > m_primTerseUpdatesPerPacket) | 3705 | if (max > m_primTerseUpdatesPerPacket) |
3688 | max = m_primTerseUpdatesPerPacket; | 3706 | max = m_primTerseUpdatesPerPacket; |
3689 | 3707 | ||
3690 | int count = 0; | 3708 | int count = 0; |
3691 | int size = 0; | 3709 | int size = 0; |
3692 | 3710 | ||
3693 | byte[] zerobuffer = new byte[1024]; | 3711 | byte[] zerobuffer = new byte[1024]; |
3694 | byte[] blockbuffer = new byte[1024]; | 3712 | byte[] blockbuffer = new byte[1024]; |
3695 | 3713 | ||
3696 | for (count = 0 ; count < max ; count++) | 3714 | lock (m_primTerseUpdates) |
3715 | { | ||
3716 | for (count = 0; count < max; count++) | ||
3697 | { | 3717 | { |
3698 | int length = 0; | 3718 | int length = 0; |
3699 | m_primTerseUpdates[count].ToBytes(blockbuffer, ref length); | 3719 | m_primTerseUpdates[count].ToBytes(blockbuffer, ref length); |
@@ -3718,9 +3738,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3718 | OutPacket(outPacket, ThrottleOutPacketType.Task); | 3738 | OutPacket(outPacket, ThrottleOutPacketType.Task); |
3719 | 3739 | ||
3720 | if (m_primTerseUpdates.Count == 0) | 3740 | if (m_primTerseUpdates.Count == 0) |
3721 | lock (m_primTerseUpdateTimer) | 3741 | stopTimer = true; |
3722 | m_primTerseUpdateTimer.Stop(); | ||
3723 | } | 3742 | } |
3743 | if (stopTimer) | ||
3744 | lock (m_primTerseUpdateTimer) | ||
3745 | m_primTerseUpdateTimer.Stop(); | ||
3724 | } | 3746 | } |
3725 | 3747 | ||
3726 | public void FlushPrimUpdates() | 3748 | public void FlushPrimUpdates() |