diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 158 |
1 files changed, 101 insertions, 57 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 59d1c69..06f1301 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -358,7 +358,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
358 | // protected HashSet<uint> m_attachmentsSent; | 358 | // protected HashSet<uint> m_attachmentsSent; |
359 | 359 | ||
360 | private bool m_deliverPackets = true; | 360 | private bool m_deliverPackets = true; |
361 | private int m_animationSequenceNumber = 1; | 361 | |
362 | private bool m_SendLogoutPacketWhenClosing = true; | 362 | private bool m_SendLogoutPacketWhenClosing = true; |
363 | 363 | ||
364 | /// <summary> | 364 | /// <summary> |
@@ -419,6 +419,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
419 | public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } | 419 | public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } |
420 | public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } | 420 | public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } |
421 | 421 | ||
422 | public int PingTimeMS | ||
423 | { | ||
424 | get | ||
425 | { | ||
426 | if (UDPClient != null) | ||
427 | return UDPClient.PingTimeMS; | ||
428 | return 0; | ||
429 | } | ||
430 | } | ||
431 | |||
422 | /// <summary> | 432 | /// <summary> |
423 | /// Entity update queues | 433 | /// Entity update queues |
424 | /// </summary> | 434 | /// </summary> |
@@ -440,7 +450,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
440 | public string Name { get { return FirstName + " " + LastName; } } | 450 | public string Name { get { return FirstName + " " + LastName; } } |
441 | 451 | ||
442 | public uint CircuitCode { get { return m_circuitCode; } } | 452 | public uint CircuitCode { get { return m_circuitCode; } } |
443 | public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } | 453 | public int NextAnimationSequenceNumber |
454 | { | ||
455 | get { return m_udpServer.NextAnimationSequenceNumber; } | ||
456 | } | ||
444 | 457 | ||
445 | /// <summary> | 458 | /// <summary> |
446 | /// As well as it's function in IClientAPI, in LLClientView we are locking on this property in order to | 459 | /// As well as it's function in IClientAPI, in LLClientView we are locking on this property in order to |
@@ -461,6 +474,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
461 | set { m_disableFacelights = value; } | 474 | set { m_disableFacelights = value; } |
462 | } | 475 | } |
463 | 476 | ||
477 | |||
464 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } | 478 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } |
465 | 479 | ||
466 | 480 | ||
@@ -1638,6 +1652,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1638 | pc.PingID.OldestUnacked = 0; | 1652 | pc.PingID.OldestUnacked = 0; |
1639 | 1653 | ||
1640 | OutPacket(pc, ThrottleOutPacketType.Unknown); | 1654 | OutPacket(pc, ThrottleOutPacketType.Unknown); |
1655 | UDPClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount(); | ||
1641 | } | 1656 | } |
1642 | 1657 | ||
1643 | public void SendKillObject(List<uint> localIDs) | 1658 | public void SendKillObject(List<uint> localIDs) |
@@ -3813,8 +3828,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3813 | { | 3828 | { |
3814 | SceneObjectPart e = (SceneObjectPart)entity; | 3829 | SceneObjectPart e = (SceneObjectPart)entity; |
3815 | SceneObjectGroup g = e.ParentGroup; | 3830 | SceneObjectGroup g = e.ParentGroup; |
3816 | if (g.RootPart.Shape.State > 30 && g.RootPart.Shape.State < 39) // HUD | 3831 | if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId) |
3817 | if (g.OwnerID != AgentId) | ||
3818 | return; // Don't send updates for other people's HUDs | 3832 | return; // Don't send updates for other people's HUDs |
3819 | } | 3833 | } |
3820 | 3834 | ||
@@ -3824,47 +3838,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3824 | m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); | 3838 | m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); |
3825 | } | 3839 | } |
3826 | 3840 | ||
3827 | /// <summary> | 3841 | /* dont use this |
3828 | /// Requeue an EntityUpdate when it was not acknowledged by the client. | 3842 | udp packet resent must be done at udp level only |
3829 | /// We will update the priority and put it in the correct queue, merging update flags | 3843 | re map from a packet to original updates just doesnt work |
3830 | /// with any other updates that may be queued for the same entity. | ||
3831 | /// The original update time is used for the merged update. | ||
3832 | /// </summary> | ||
3833 | private void ResendPrimUpdate(EntityUpdate update) | ||
3834 | { | ||
3835 | // If the update exists in priority queue, it will be updated. | ||
3836 | // If it does not exist then it will be added with the current (rather than its original) priority | ||
3837 | uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); | ||
3838 | 3844 | ||
3839 | lock (m_entityUpdates.SyncRoot) | 3845 | /// <summary> |
3840 | m_entityUpdates.Enqueue(priority, update); | 3846 | /// Requeue an EntityUpdate when it was not acknowledged by the client. |
3841 | } | 3847 | /// We will update the priority and put it in the correct queue, merging update flags |
3848 | /// with any other updates that may be queued for the same entity. | ||
3849 | /// The original update time is used for the merged update. | ||
3850 | /// </summary> | ||
3851 | private void ResendPrimUpdate(EntityUpdate update) | ||
3852 | { | ||
3853 | // If the update exists in priority queue, it will be updated. | ||
3854 | // If it does not exist then it will be added with the current (rather than its original) priority | ||
3855 | uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); | ||
3842 | 3856 | ||
3843 | /// <summary> | 3857 | lock (m_entityUpdates.SyncRoot) |
3844 | /// Requeue a list of EntityUpdates when they were not acknowledged by the client. | 3858 | m_entityUpdates.Enqueue(priority, update); |
3845 | /// We will update the priority and put it in the correct queue, merging update flags | 3859 | } |
3846 | /// with any other updates that may be queued for the same entity. | ||
3847 | /// The original update time is used for the merged update. | ||
3848 | /// </summary> | ||
3849 | private void ResendPrimUpdates(List<EntityUpdate> updates, OutgoingPacket oPacket) | ||
3850 | { | ||
3851 | // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber); | ||
3852 | 3860 | ||
3853 | // Remove the update packet from the list of packets waiting for acknowledgement | ||
3854 | // because we are requeuing the list of updates. They will be resent in new packets | ||
3855 | // with the most recent state and priority. | ||
3856 | m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); | ||
3857 | 3861 | ||
3858 | // Count this as a resent packet since we are going to requeue all of the updates contained in it | 3862 | /// <summary> |
3859 | Interlocked.Increment(ref m_udpClient.PacketsResent); | 3863 | /// Requeue a list of EntityUpdates when they were not acknowledged by the client. |
3864 | /// We will update the priority and put it in the correct queue, merging update flags | ||
3865 | /// with any other updates that may be queued for the same entity. | ||
3866 | /// The original update time is used for the merged update. | ||
3867 | /// </summary> | ||
3868 | private void ResendPrimUpdates(List<EntityUpdate> updates, OutgoingPacket oPacket) | ||
3869 | { | ||
3870 | // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber); | ||
3860 | 3871 | ||
3861 | // We're not going to worry about interlock yet since its not currently critical that this total count | 3872 | // Remove the update packet from the list of packets waiting for acknowledgement |
3862 | // is 100% correct | 3873 | // because we are requeuing the list of updates. They will be resent in new packets |
3863 | m_udpServer.PacketsResentCount++; | 3874 | // with the most recent state and priority. |
3875 | m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); | ||
3864 | 3876 | ||
3865 | foreach (EntityUpdate update in updates) | 3877 | // Count this as a resent packet since we are going to requeue all of the updates contained in it |
3866 | ResendPrimUpdate(update); | 3878 | Interlocked.Increment(ref m_udpClient.PacketsResent); |
3867 | } | 3879 | |
3880 | // We're not going to worry about interlock yet since its not currently critical that this total count | ||
3881 | // is 100% correct | ||
3882 | m_udpServer.PacketsResentCount++; | ||
3883 | |||
3884 | foreach (EntityUpdate update in updates) | ||
3885 | ResendPrimUpdate(update); | ||
3886 | } | ||
3887 | */ | ||
3868 | 3888 | ||
3869 | // OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); | 3889 | // OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); |
3870 | // OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); | 3890 | // OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); |
@@ -3932,8 +3952,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3932 | 3952 | ||
3933 | if (part.ParentGroup.IsAttachment) | 3953 | if (part.ParentGroup.IsAttachment) |
3934 | { // Someone else's HUD, why are we getting these? | 3954 | { // Someone else's HUD, why are we getting these? |
3935 | if (part.ParentGroup.OwnerID != AgentId && | 3955 | if (part.ParentGroup.OwnerID != AgentId && part.ParentGroup.HasPrivateAttachmentPoint) |
3936 | part.ParentGroup.RootPart.Shape.State > 30 && part.ParentGroup.RootPart.Shape.State < 39) | ||
3937 | continue; | 3956 | continue; |
3938 | ScenePresence sp; | 3957 | ScenePresence sp; |
3939 | // Owner is not in the sim, don't update it to | 3958 | // Owner is not in the sim, don't update it to |
@@ -4184,12 +4203,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4184 | for (int i = 0; i < blocks.Count; i++) | 4203 | for (int i = 0; i < blocks.Count; i++) |
4185 | packet.ObjectData[i] = blocks[i]; | 4204 | packet.ObjectData[i] = blocks[i]; |
4186 | 4205 | ||
4187 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | 4206 | // OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); |
4207 | // use default udp retry | ||
4208 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4188 | } | 4209 | } |
4189 | 4210 | ||
4211 | |||
4212 | |||
4190 | #endregion Packet Sending | 4213 | #endregion Packet Sending |
4214 | |||
4191 | } | 4215 | } |
4192 | 4216 | ||
4217 | // hack.. dont use | ||
4218 | public void SendPartFullUpdate(ISceneEntity ent, uint? parentID) | ||
4219 | { | ||
4220 | if (ent is SceneObjectPart) | ||
4221 | { | ||
4222 | SceneObjectPart part = (SceneObjectPart)ent; | ||
4223 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | ||
4224 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4225 | packet.RegionData.TimeDilation = 1; | ||
4226 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | ||
4227 | |||
4228 | ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, this.m_agentId); | ||
4229 | if (parentID.HasValue) | ||
4230 | { | ||
4231 | blk.ParentID = parentID.Value; | ||
4232 | } | ||
4233 | |||
4234 | packet.ObjectData[0] = blk; | ||
4235 | |||
4236 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4237 | } | ||
4238 | } | ||
4239 | |||
4193 | public void ReprioritizeUpdates() | 4240 | public void ReprioritizeUpdates() |
4194 | { | 4241 | { |
4195 | lock (m_entityUpdates.SyncRoot) | 4242 | lock (m_entityUpdates.SyncRoot) |
@@ -5278,16 +5325,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5278 | 5325 | ||
5279 | byte[] objectData = new byte[76]; | 5326 | byte[] objectData = new byte[76]; |
5280 | 5327 | ||
5281 | data.CollisionPlane.ToBytes(objectData, 0); | ||
5282 | offsetPosition.ToBytes(objectData, 16); | ||
5283 | Vector3 velocity = new Vector3(0, 0, 0); | 5328 | Vector3 velocity = new Vector3(0, 0, 0); |
5284 | Vector3 acceleration = new Vector3(0, 0, 0); | 5329 | Vector3 acceleration = new Vector3(0, 0, 0); |
5330 | rotation.Normalize(); | ||
5331 | Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z); | ||
5332 | |||
5333 | data.CollisionPlane.ToBytes(objectData, 0); | ||
5334 | offsetPosition.ToBytes(objectData, 16); | ||
5285 | velocity.ToBytes(objectData, 28); | 5335 | velocity.ToBytes(objectData, 28); |
5286 | acceleration.ToBytes(objectData, 40); | 5336 | acceleration.ToBytes(objectData, 40); |
5287 | // data.Velocity.ToBytes(objectData, 28); | 5337 | vrot.ToBytes(objectData, 52); |
5288 | // data.Acceleration.ToBytes(objectData, 40); | 5338 | data.AngularVelocity.ToBytes(objectData, 64); |
5289 | rotation.ToBytes(objectData, 52); | ||
5290 | //data.AngularVelocity.ToBytes(objectData, 64); | ||
5291 | 5339 | ||
5292 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | 5340 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); |
5293 | 5341 | ||
@@ -5343,15 +5391,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5343 | data.RelativePosition.ToBytes(objectData, 0); | 5391 | data.RelativePosition.ToBytes(objectData, 0); |
5344 | data.Velocity.ToBytes(objectData, 12); | 5392 | data.Velocity.ToBytes(objectData, 12); |
5345 | data.Acceleration.ToBytes(objectData, 24); | 5393 | data.Acceleration.ToBytes(objectData, 24); |
5346 | try | 5394 | |
5347 | { | 5395 | Quaternion rotation = data.RotationOffset; |
5348 | data.RotationOffset.ToBytes(objectData, 36); | 5396 | rotation.Normalize(); |
5349 | } | 5397 | Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z); |
5350 | catch (Exception e) | 5398 | vrot.ToBytes(objectData, 36); |
5351 | { | ||
5352 | m_log.Warn("[LLClientView]: exception converting quaternion to bytes, using Quaternion.Identity. Exception: " + e.ToString()); | ||
5353 | OpenMetaverse.Quaternion.Identity.ToBytes(objectData, 36); | ||
5354 | } | ||
5355 | data.AngularVelocity.ToBytes(objectData, 48); | 5399 | data.AngularVelocity.ToBytes(objectData, 48); |
5356 | 5400 | ||
5357 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | 5401 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); |