diff options
author | Melanie | 2010-12-15 22:59:52 +0000 |
---|---|---|
committer | Melanie | 2010-12-15 22:59:52 +0000 |
commit | d457b4c4b19902c67c0653b6c0c0b11496591dcd (patch) | |
tree | 188ad3f7743c1a775d5e7b87459b9658e05c7c9d /OpenSim | |
parent | Make sure the material is set on physical prims (diff) | |
parent | Put in locks on m_killRecord to replace changed locks on m_entityUpdates.Sync... (diff) | |
download | opensim-SC_OLD-d457b4c4b19902c67c0653b6c0c0b11496591dcd.zip opensim-SC_OLD-d457b4c4b19902c67c0653b6c0c0b11496591dcd.tar.gz opensim-SC_OLD-d457b4c4b19902c67c0653b6c0c0b11496591dcd.tar.bz2 opensim-SC_OLD-d457b4c4b19902c67c0653b6c0c0b11496591dcd.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 457 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 33 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 |
3 files changed, 256 insertions, 240 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 6a76069..196ac50 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -328,7 +328,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
328 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an | 328 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an |
329 | /// ownerless phantom. | 329 | /// ownerless phantom. |
330 | /// | 330 | /// |
331 | /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock | 331 | /// All manipulation of this set has to occur under a lock |
332 | /// | 332 | /// |
333 | /// </value> | 333 | /// </value> |
334 | protected HashSet<uint> m_killRecord; | 334 | protected HashSet<uint> m_killRecord; |
@@ -1536,11 +1536,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1536 | OutPacket(kill, ThrottleOutPacketType.State); | 1536 | OutPacket(kill, ThrottleOutPacketType.State); |
1537 | return; | 1537 | return; |
1538 | } | 1538 | } |
1539 | m_killRecord.Add(localIDs[0]); | 1539 | lock (m_killRecord) |
1540 | { | ||
1541 | m_killRecord.Add(localIDs[0]); | ||
1542 | } | ||
1540 | } | 1543 | } |
1541 | else | 1544 | else |
1542 | { | 1545 | { |
1543 | lock (m_entityUpdates.SyncRoot) | 1546 | lock (m_killRecord) |
1544 | { | 1547 | { |
1545 | foreach (uint localID in localIDs) | 1548 | foreach (uint localID in localIDs) |
1546 | m_killRecord.Add(localID); | 1549 | m_killRecord.Add(localID); |
@@ -3595,248 +3598,254 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3595 | int updatesThisCall = 0; | 3598 | int updatesThisCall = 0; |
3596 | 3599 | ||
3597 | EntityUpdate update; | 3600 | EntityUpdate update; |
3598 | while (updatesThisCall < maxUpdates) | 3601 | lock (m_killRecord) |
3599 | { | 3602 | { |
3600 | lock (m_entityUpdates.SyncRoot) | 3603 | while (updatesThisCall < maxUpdates) |
3601 | if (!m_entityUpdates.TryDequeue(out update)) | 3604 | { |
3602 | break; | 3605 | lock (m_entityUpdates.SyncRoot) |
3606 | if (!m_entityUpdates.TryDequeue(out update)) | ||
3607 | break; | ||
3603 | 3608 | ||
3604 | if (update.Entity is SceneObjectPart) | 3609 | if (update.Entity is SceneObjectPart) |
3605 | { | 3610 | { |
3606 | SceneObjectPart part = (SceneObjectPart)update.Entity; | 3611 | SceneObjectPart part = (SceneObjectPart)update.Entity; |
3607 | 3612 | ||
3608 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client | 3613 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client |
3609 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good | 3614 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good |
3610 | // safety measure. | 3615 | // safety measure. |
3611 | // | 3616 | // |
3612 | // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update | 3617 | // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update |
3613 | // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs | 3618 | // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs |
3614 | // updates and kills on different threads with different scheduling strategies, hence this protection. | 3619 | // updates and kills on different threads with different scheduling strategies, hence this protection. |
3615 | // | 3620 | // |
3616 | // This doesn't appear to apply to child prims - a client will happily ignore these updates | 3621 | // This doesn't appear to apply to child prims - a client will happily ignore these updates |
3617 | // after the root prim has been deleted. | 3622 | // after the root prim has been deleted. |
3618 | if (m_killRecord.Contains(part.LocalId)) | 3623 | if (m_killRecord.Contains(part.LocalId)) |
3619 | continue; | ||
3620 | if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) | ||
3621 | continue; | ||
3622 | |||
3623 | if (part.ParentGroup.IsDeleted) | ||
3624 | continue; | ||
3625 | |||
3626 | if (part.ParentGroup.IsAttachment) | ||
3627 | { // Someone else's HUD, why are we getting these? | ||
3628 | if (part.ParentGroup.OwnerID != AgentId && | ||
3629 | part.ParentGroup.RootPart.Shape.State >= 30) | ||
3630 | continue; | 3624 | continue; |
3631 | ScenePresence sp; | 3625 | if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) |
3632 | // Owner is not in the sim, don't update it to | ||
3633 | // anyone | ||
3634 | if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) | ||
3635 | continue; | 3626 | continue; |
3636 | 3627 | ||
3637 | List<SceneObjectGroup> atts = sp.Attachments; | 3628 | if (part.ParentGroup.IsDeleted) |
3638 | bool found = false; | 3629 | continue; |
3639 | foreach (SceneObjectGroup att in atts) | 3630 | |
3640 | { | 3631 | if (part.ParentGroup.IsAttachment) |
3641 | if (att == part.ParentGroup) | 3632 | { // Someone else's HUD, why are we getting these? |
3633 | if (part.ParentGroup.OwnerID != AgentId && | ||
3634 | part.ParentGroup.RootPart.Shape.State >= 30) | ||
3635 | continue; | ||
3636 | ScenePresence sp; | ||
3637 | // Owner is not in the sim, don't update it to | ||
3638 | // anyone | ||
3639 | if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) | ||
3640 | continue; | ||
3641 | |||
3642 | List<SceneObjectGroup> atts = sp.Attachments; | ||
3643 | bool found = false; | ||
3644 | foreach (SceneObjectGroup att in atts) | ||
3642 | { | 3645 | { |
3643 | found = true; | 3646 | if (att == part.ParentGroup) |
3644 | break; | 3647 | { |
3648 | found = true; | ||
3649 | break; | ||
3650 | } | ||
3645 | } | 3651 | } |
3646 | } | ||
3647 | 3652 | ||
3648 | // It's an attachment of a valid avatar, but | 3653 | // It's an attachment of a valid avatar, but |
3649 | // doesn't seem to be attached, skip | 3654 | // doesn't seem to be attached, skip |
3650 | if (!found) | 3655 | if (!found) |
3651 | continue; | 3656 | continue; |
3652 | } | 3657 | } |
3653 | 3658 | ||
3654 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | 3659 | if (part.ParentGroup.IsAttachment && m_disableFacelights) |
3655 | { | ||
3656 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | ||
3657 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
3658 | { | 3660 | { |
3659 | part.Shape.LightEntry = false; | 3661 | if (part.ParentGroup.IsAttachment && m_disableFacelights) |
3662 | { | ||
3663 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | ||
3664 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
3665 | { | ||
3666 | part.Shape.LightEntry = false; | ||
3667 | } | ||
3668 | } | ||
3669 | } | ||
3670 | |||
3671 | ++updatesThisCall; | ||
3672 | |||
3673 | #region UpdateFlags to packet type conversion | ||
3674 | |||
3675 | PrimUpdateFlags updateFlags = update.Flags; | ||
3676 | |||
3677 | bool canUseCompressed = true; | ||
3678 | bool canUseImproved = true; | ||
3679 | |||
3680 | // Compressed object updates only make sense for LL primitives | ||
3681 | if (!(update.Entity is SceneObjectPart)) | ||
3682 | { | ||
3683 | canUseCompressed = false; | ||
3660 | } | 3684 | } |
3685 | |||
3686 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | ||
3687 | { | ||
3688 | canUseCompressed = false; | ||
3689 | canUseImproved = false; | ||
3690 | } | ||
3691 | else | ||
3692 | { | ||
3693 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | ||
3694 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
3695 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
3696 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3697 | { | ||
3698 | canUseCompressed = false; | ||
3699 | } | ||
3700 | |||
3701 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | ||
3702 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3703 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3704 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3705 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3706 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3707 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3708 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3709 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3710 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3711 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3712 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3713 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3714 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3715 | { | ||
3716 | canUseImproved = false; | ||
3717 | } | ||
3718 | } | ||
3719 | |||
3720 | #endregion UpdateFlags to packet type conversion | ||
3721 | |||
3722 | #region Block Construction | ||
3723 | |||
3724 | // TODO: Remove this once we can build compressed updates | ||
3725 | canUseCompressed = false; | ||
3726 | |||
3727 | if (!canUseImproved && !canUseCompressed) | ||
3728 | { | ||
3729 | if (update.Entity is ScenePresence) | ||
3730 | { | ||
3731 | objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); | ||
3732 | } | ||
3733 | else | ||
3734 | { | ||
3735 | // if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment) | ||
3736 | // { | ||
3737 | // SceneObjectPart sop = (SceneObjectPart)update.Entity; | ||
3738 | // string text = sop.Text; | ||
3739 | // if (text.IndexOf("\n") >= 0) | ||
3740 | // text = text.Remove(text.IndexOf("\n")); | ||
3741 | // | ||
3742 | // if (m_attachmentsSent.Contains(sop.ParentID)) | ||
3743 | // { | ||
3744 | //// m_log.DebugFormat( | ||
3745 | //// "[CLIENT]: Sending full info about attached prim {0} text {1}", | ||
3746 | //// sop.LocalId, text); | ||
3747 | // | ||
3748 | // objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId)); | ||
3749 | // | ||
3750 | // m_attachmentsSent.Add(sop.LocalId); | ||
3751 | // } | ||
3752 | // else | ||
3753 | // { | ||
3754 | // m_log.DebugFormat( | ||
3755 | // "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", | ||
3756 | // sop.LocalId, text, sop.ParentID); | ||
3757 | // | ||
3758 | // m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); | ||
3759 | // } | ||
3760 | // } | ||
3761 | // else | ||
3762 | // { | ||
3763 | objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); | ||
3764 | // } | ||
3765 | } | ||
3766 | } | ||
3767 | else if (!canUseImproved) | ||
3768 | { | ||
3769 | compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); | ||
3770 | } | ||
3771 | else | ||
3772 | { | ||
3773 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) | ||
3774 | // Self updates go into a special list | ||
3775 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3776 | else | ||
3777 | // Everything else goes here | ||
3778 | terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3779 | } | ||
3780 | |||
3781 | #endregion Block Construction | ||
3661 | } | 3782 | } |
3662 | } | 3783 | |
3663 | 3784 | #region Packet Sending | |
3664 | ++updatesThisCall; | 3785 | |
3665 | 3786 | const float TIME_DILATION = 1.0f; | |
3666 | #region UpdateFlags to packet type conversion | 3787 | ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); |
3667 | 3788 | ||
3668 | PrimUpdateFlags updateFlags = update.Flags; | 3789 | if (terseAgentUpdateBlocks.IsValueCreated) |
3669 | |||
3670 | bool canUseCompressed = true; | ||
3671 | bool canUseImproved = true; | ||
3672 | |||
3673 | // Compressed object updates only make sense for LL primitives | ||
3674 | if (!(update.Entity is SceneObjectPart)) | ||
3675 | { | ||
3676 | canUseCompressed = false; | ||
3677 | } | ||
3678 | |||
3679 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | ||
3680 | { | ||
3681 | canUseCompressed = false; | ||
3682 | canUseImproved = false; | ||
3683 | } | ||
3684 | else | ||
3685 | { | ||
3686 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | ||
3687 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
3688 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
3689 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3690 | { | 3790 | { |
3691 | canUseCompressed = false; | 3791 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; |
3792 | |||
3793 | ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); | ||
3794 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3795 | packet.RegionData.TimeDilation = timeDilation; | ||
3796 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
3797 | |||
3798 | for (int i = 0; i < blocks.Count; i++) | ||
3799 | packet.ObjectData[i] = blocks[i]; | ||
3800 | |||
3801 | OutPacket(packet, ThrottleOutPacketType.Unknown, true); | ||
3692 | } | 3802 | } |
3693 | 3803 | ||
3694 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | 3804 | if (objectUpdateBlocks.IsValueCreated) |
3695 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3696 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3697 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3698 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3699 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3700 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3701 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3702 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3703 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3704 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3705 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3706 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3707 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3708 | { | 3805 | { |
3709 | canUseImproved = false; | 3806 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; |
3807 | |||
3808 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | ||
3809 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3810 | packet.RegionData.TimeDilation = timeDilation; | ||
3811 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
3812 | |||
3813 | for (int i = 0; i < blocks.Count; i++) | ||
3814 | packet.ObjectData[i] = blocks[i]; | ||
3815 | |||
3816 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
3710 | } | 3817 | } |
3711 | } | 3818 | |
3712 | 3819 | if (compressedUpdateBlocks.IsValueCreated) | |
3713 | #endregion UpdateFlags to packet type conversion | ||
3714 | |||
3715 | #region Block Construction | ||
3716 | |||
3717 | // TODO: Remove this once we can build compressed updates | ||
3718 | canUseCompressed = false; | ||
3719 | |||
3720 | if (!canUseImproved && !canUseCompressed) | ||
3721 | { | ||
3722 | if (update.Entity is ScenePresence) | ||
3723 | { | 3820 | { |
3724 | objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); | 3821 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; |
3822 | |||
3823 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
3824 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3825 | packet.RegionData.TimeDilation = timeDilation; | ||
3826 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
3827 | |||
3828 | for (int i = 0; i < blocks.Count; i++) | ||
3829 | packet.ObjectData[i] = blocks[i]; | ||
3830 | |||
3831 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
3725 | } | 3832 | } |
3726 | else | 3833 | |
3834 | if (terseUpdateBlocks.IsValueCreated) | ||
3727 | { | 3835 | { |
3728 | // if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment) | 3836 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; |
3729 | // { | 3837 | |
3730 | // SceneObjectPart sop = (SceneObjectPart)update.Entity; | 3838 | ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); |
3731 | // string text = sop.Text; | 3839 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
3732 | // if (text.IndexOf("\n") >= 0) | 3840 | packet.RegionData.TimeDilation = timeDilation; |
3733 | // text = text.Remove(text.IndexOf("\n")); | 3841 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; |
3734 | // | 3842 | |
3735 | // if (m_attachmentsSent.Contains(sop.ParentID)) | 3843 | for (int i = 0; i < blocks.Count; i++) |
3736 | // { | 3844 | packet.ObjectData[i] = blocks[i]; |
3737 | //// m_log.DebugFormat( | 3845 | |
3738 | //// "[CLIENT]: Sending full info about attached prim {0} text {1}", | 3846 | OutPacket(packet, ThrottleOutPacketType.Task, true); |
3739 | //// sop.LocalId, text); | ||
3740 | // | ||
3741 | // objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId)); | ||
3742 | // | ||
3743 | // m_attachmentsSent.Add(sop.LocalId); | ||
3744 | // } | ||
3745 | // else | ||
3746 | // { | ||
3747 | // m_log.DebugFormat( | ||
3748 | // "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", | ||
3749 | // sop.LocalId, text, sop.ParentID); | ||
3750 | // | ||
3751 | // m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); | ||
3752 | // } | ||
3753 | // } | ||
3754 | // else | ||
3755 | // { | ||
3756 | objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); | ||
3757 | // } | ||
3758 | } | 3847 | } |
3759 | } | 3848 | } |
3760 | else if (!canUseImproved) | ||
3761 | { | ||
3762 | compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); | ||
3763 | } | ||
3764 | else | ||
3765 | { | ||
3766 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) | ||
3767 | // Self updates go into a special list | ||
3768 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3769 | else | ||
3770 | // Everything else goes here | ||
3771 | terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3772 | } | ||
3773 | |||
3774 | #endregion Block Construction | ||
3775 | } | ||
3776 | |||
3777 | #region Packet Sending | ||
3778 | |||
3779 | const float TIME_DILATION = 1.0f; | ||
3780 | ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); | ||
3781 | |||
3782 | if (terseAgentUpdateBlocks.IsValueCreated) | ||
3783 | { | ||
3784 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | ||
3785 | |||
3786 | ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); | ||
3787 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3788 | packet.RegionData.TimeDilation = timeDilation; | ||
3789 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
3790 | |||
3791 | for (int i = 0; i < blocks.Count; i++) | ||
3792 | packet.ObjectData[i] = blocks[i]; | ||
3793 | |||
3794 | OutPacket(packet, ThrottleOutPacketType.Unknown, true); | ||
3795 | } | ||
3796 | |||
3797 | if (objectUpdateBlocks.IsValueCreated) | ||
3798 | { | ||
3799 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; | ||
3800 | |||
3801 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | ||
3802 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3803 | packet.RegionData.TimeDilation = timeDilation; | ||
3804 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
3805 | |||
3806 | for (int i = 0; i < blocks.Count; i++) | ||
3807 | packet.ObjectData[i] = blocks[i]; | ||
3808 | |||
3809 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
3810 | } | ||
3811 | |||
3812 | if (compressedUpdateBlocks.IsValueCreated) | ||
3813 | { | ||
3814 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
3815 | |||
3816 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
3817 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3818 | packet.RegionData.TimeDilation = timeDilation; | ||
3819 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
3820 | |||
3821 | for (int i = 0; i < blocks.Count; i++) | ||
3822 | packet.ObjectData[i] = blocks[i]; | ||
3823 | |||
3824 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
3825 | } | ||
3826 | |||
3827 | if (terseUpdateBlocks.IsValueCreated) | ||
3828 | { | ||
3829 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
3830 | |||
3831 | ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); | ||
3832 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3833 | packet.RegionData.TimeDilation = timeDilation; | ||
3834 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
3835 | |||
3836 | for (int i = 0; i < blocks.Count; i++) | ||
3837 | packet.ObjectData[i] = blocks[i]; | ||
3838 | |||
3839 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
3840 | } | 3849 | } |
3841 | 3850 | ||
3842 | #endregion Packet Sending | 3851 | #endregion Packet Sending |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f81030c..45625d6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -152,7 +152,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
152 | private int m_update_backup = 200; | 152 | private int m_update_backup = 200; |
153 | private int m_update_terrain = 50; | 153 | private int m_update_terrain = 50; |
154 | private int m_update_land = 1; | 154 | private int m_update_land = 1; |
155 | private int m_update_coarse_locations = 50; | 155 | private int m_update_coarse_locations = 80; |
156 | 156 | ||
157 | private int frameMS; | 157 | private int frameMS; |
158 | private int physicsMS2; | 158 | private int physicsMS2; |
@@ -181,6 +181,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
181 | private object m_deleting_scene_object = new object(); | 181 | private object m_deleting_scene_object = new object(); |
182 | private object m_cleaningAttachments = new object(); | 182 | private object m_cleaningAttachments = new object(); |
183 | 183 | ||
184 | private bool m_cleaningTemps = false; | ||
185 | |||
184 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 186 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
185 | private bool m_reprioritizationEnabled = true; | 187 | private bool m_reprioritizationEnabled = true; |
186 | private double m_reprioritizationInterval = 5000.0; | 188 | private double m_reprioritizationInterval = 5000.0; |
@@ -1296,10 +1298,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1296 | physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS); | 1298 | physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS); |
1297 | 1299 | ||
1298 | // Delete temp-on-rez stuff | 1300 | // Delete temp-on-rez stuff |
1299 | if (m_frame % m_update_backup == 0) | 1301 | if (m_frame % 1000 == 0 && !m_cleaningTemps) |
1300 | { | 1302 | { |
1301 | int tmpTempOnRezMS = Util.EnvironmentTickCount(); | 1303 | int tmpTempOnRezMS = Util.EnvironmentTickCount(); |
1302 | CleanTempObjects(); | 1304 | m_cleaningTemps = true; |
1305 | Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); | ||
1303 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS); | 1306 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS); |
1304 | } | 1307 | } |
1305 | 1308 | ||
@@ -1326,12 +1329,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1326 | terrainMS = Util.EnvironmentTickCountSubtract(terMS); | 1329 | terrainMS = Util.EnvironmentTickCountSubtract(terMS); |
1327 | } | 1330 | } |
1328 | 1331 | ||
1329 | if (m_frame % m_update_land == 0) | 1332 | //if (m_frame % m_update_land == 0) |
1330 | { | 1333 | //{ |
1331 | int ldMS = Util.EnvironmentTickCount(); | 1334 | // int ldMS = Util.EnvironmentTickCount(); |
1332 | UpdateLand(); | 1335 | // UpdateLand(); |
1333 | landMS = Util.EnvironmentTickCountSubtract(ldMS); | 1336 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); |
1334 | } | 1337 | //} |
1335 | 1338 | ||
1336 | frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); | 1339 | frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); |
1337 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 1340 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; |
@@ -1424,13 +1427,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1424 | 1427 | ||
1425 | private void CheckAtTargets() | 1428 | private void CheckAtTargets() |
1426 | { | 1429 | { |
1430 | Dictionary<UUID, SceneObjectGroup>.ValueCollection objs; | ||
1427 | lock (m_groupsWithTargets) | 1431 | lock (m_groupsWithTargets) |
1428 | { | 1432 | objs = m_groupsWithTargets.Values; |
1429 | foreach (SceneObjectGroup entry in m_groupsWithTargets.Values) | 1433 | |
1430 | { | 1434 | foreach (SceneObjectGroup entry in objs) |
1431 | entry.checkAtTargets(); | 1435 | entry.checkAtTargets(); |
1432 | } | ||
1433 | } | ||
1434 | } | 1436 | } |
1435 | 1437 | ||
1436 | 1438 | ||
@@ -4539,6 +4541,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4539 | } | 4541 | } |
4540 | } | 4542 | } |
4541 | } | 4543 | } |
4544 | |||
4542 | } | 4545 | } |
4543 | 4546 | ||
4544 | public void DeleteFromStorage(UUID uuid) | 4547 | public void DeleteFromStorage(UUID uuid) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d83ff51..254fe37 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2635,6 +2635,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2635 | 2635 | ||
2636 | #region Overridden Methods | 2636 | #region Overridden Methods |
2637 | 2637 | ||
2638 | private bool sendingPrims = false; | ||
2639 | |||
2638 | public override void Update() | 2640 | public override void Update() |
2639 | { | 2641 | { |
2640 | const float ROTATION_TOLERANCE = 0.01f; | 2642 | const float ROTATION_TOLERANCE = 0.01f; |
@@ -2642,7 +2644,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2642 | const float POSITION_TOLERANCE = 0.05f; | 2644 | const float POSITION_TOLERANCE = 0.05f; |
2643 | //const int TIME_MS_TOLERANCE = 3000; | 2645 | //const int TIME_MS_TOLERANCE = 3000; |
2644 | 2646 | ||
2645 | 2647 | if (!sendingPrims) | |
2648 | Util.FireAndForget(delegate { sendingPrims = true; SendPrimUpdates(); sendingPrims = false; }); | ||
2646 | 2649 | ||
2647 | if (m_isChildAgent == false) | 2650 | if (m_isChildAgent == false) |
2648 | { | 2651 | { |
@@ -2670,6 +2673,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2670 | // followed suggestion from mic bowman. reversed the two lines below. | 2673 | // followed suggestion from mic bowman. reversed the two lines below. |
2671 | if (m_parentID == 0 && m_physicsActor != null || m_parentID != 0) // Check that we have a physics actor or we're sitting on something | 2674 | if (m_parentID == 0 && m_physicsActor != null || m_parentID != 0) // Check that we have a physics actor or we're sitting on something |
2672 | CheckForBorderCrossing(); | 2675 | CheckForBorderCrossing(); |
2676 | |||
2673 | CheckForSignificantMovement(); // sends update to the modules. | 2677 | CheckForSignificantMovement(); // sends update to the modules. |
2674 | } | 2678 | } |
2675 | 2679 | ||