aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs3
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs682
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs12
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs4
5 files changed, 414 insertions, 291 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index e9e2dca..9dd6663 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
@@ -202,6 +202,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
202 m_stopPacket = TexturePacketCount(); 202 m_stopPacket = TexturePacketCount();
203 } 203 }
204 204
205 //Give them at least two packets, to play nice with some broken viewers (SL also behaves this way)
206 if (m_stopPacket == 1 && Layers[0].End > FIRST_PACKET_SIZE) m_stopPacket++;
207
205 m_currentPacket = StartPacket; 208 m_currentPacket = StartPacket;
206 } 209 }
207 } 210 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 4a0b0c6..cf09cc9 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -157,6 +157,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
157 public event RequestTaskInventory OnRequestTaskInventory; 157 public event RequestTaskInventory OnRequestTaskInventory;
158 public event UpdateInventoryItem OnUpdateInventoryItem; 158 public event UpdateInventoryItem OnUpdateInventoryItem;
159 public event CopyInventoryItem OnCopyInventoryItem; 159 public event CopyInventoryItem OnCopyInventoryItem;
160 public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
160 public event MoveInventoryItem OnMoveInventoryItem; 161 public event MoveInventoryItem OnMoveInventoryItem;
161 public event RemoveInventoryItem OnRemoveInventoryItem; 162 public event RemoveInventoryItem OnRemoveInventoryItem;
162 public event RemoveInventoryFolder OnRemoveInventoryFolder; 163 public event RemoveInventoryFolder OnRemoveInventoryFolder;
@@ -254,7 +255,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
254 public event ClassifiedInfoRequest OnClassifiedInfoRequest; 255 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
255 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; 256 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
256 public event ClassifiedDelete OnClassifiedDelete; 257 public event ClassifiedDelete OnClassifiedDelete;
257 public event ClassifiedDelete OnClassifiedGodDelete; 258 public event ClassifiedGodDelete OnClassifiedGodDelete;
258 public event EventNotificationAddRequest OnEventNotificationAddRequest; 259 public event EventNotificationAddRequest OnEventNotificationAddRequest;
259 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; 260 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
260 public event EventGodDelete OnEventGodDelete; 261 public event EventGodDelete OnEventGodDelete;
@@ -330,7 +331,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
330 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an 331 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
331 /// ownerless phantom. 332 /// ownerless phantom.
332 /// 333 ///
333 /// All manipulation of this set has to occur under a lock 334 /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
334 /// 335 ///
335 /// </value> 336 /// </value>
336 protected HashSet<uint> m_killRecord; 337 protected HashSet<uint> m_killRecord;
@@ -338,6 +339,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
338// protected HashSet<uint> m_attachmentsSent; 339// protected HashSet<uint> m_attachmentsSent;
339 340
340 private int m_moneyBalance; 341 private int m_moneyBalance;
342 private bool m_deliverPackets = true;
341 private int m_animationSequenceNumber = 1; 343 private int m_animationSequenceNumber = 1;
342 private bool m_SendLogoutPacketWhenClosing = true; 344 private bool m_SendLogoutPacketWhenClosing = true;
343 private AgentUpdateArgs lastarg; 345 private AgentUpdateArgs lastarg;
@@ -378,6 +380,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
378 get { return m_startpos; } 380 get { return m_startpos; }
379 set { m_startpos = value; } 381 set { m_startpos = value; }
380 } 382 }
383 public bool DeliverPackets
384 {
385 get { return m_deliverPackets; }
386 set {
387 m_deliverPackets = value;
388 m_udpClient.m_deliverPackets = value;
389 }
390 }
381 public UUID AgentId { get { return m_agentId; } } 391 public UUID AgentId { get { return m_agentId; } }
382 public UUID ActiveGroupId { get { return m_activeGroupID; } } 392 public UUID ActiveGroupId { get { return m_activeGroupID; } }
383 public string ActiveGroupName { get { return m_activeGroupName; } } 393 public string ActiveGroupName { get { return m_activeGroupName; } }
@@ -479,18 +489,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
479 489
480 #region Client Methods 490 #region Client Methods
481 491
492
482 /// <summary> 493 /// <summary>
483 /// Shut down the client view 494 /// Shut down the client view
484 /// </summary> 495 /// </summary>
485 public void Close() 496 public void Close()
486 { 497 {
498 Close(true);
499 }
500
501 /// <summary>
502 /// Shut down the client view
503 /// </summary>
504 public void Close(bool sendStop)
505 {
487 m_log.DebugFormat( 506 m_log.DebugFormat(
488 "[CLIENT]: Close has been called for {0} attached to scene {1}", 507 "[CLIENT]: Close has been called for {0} attached to scene {1}",
489 Name, m_scene.RegionInfo.RegionName); 508 Name, m_scene.RegionInfo.RegionName);
490 509
491 // Send the STOP packet 510 if (sendStop)
492 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); 511 {
493 OutPacket(disable, ThrottleOutPacketType.Unknown); 512 // Send the STOP packet
513 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
514 OutPacket(disable, ThrottleOutPacketType.Unknown);
515 }
494 516
495 IsActive = false; 517 IsActive = false;
496 518
@@ -791,7 +813,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
791 reply.ChatData.OwnerID = fromAgentID; 813 reply.ChatData.OwnerID = fromAgentID;
792 reply.ChatData.SourceID = fromAgentID; 814 reply.ChatData.SourceID = fromAgentID;
793 815
794 OutPacket(reply, ThrottleOutPacketType.Task); 816 OutPacket(reply, ThrottleOutPacketType.Unknown);
795 } 817 }
796 818
797 /// <summary> 819 /// <summary>
@@ -1077,6 +1099,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1077 public virtual void SendLayerData(float[] map) 1099 public virtual void SendLayerData(float[] map)
1078 { 1100 {
1079 Util.FireAndForget(DoSendLayerData, map); 1101 Util.FireAndForget(DoSendLayerData, map);
1102
1103 // Send it sync, and async. It's not that much data
1104 // and it improves user experience just so much!
1105 DoSendLayerData(map);
1080 } 1106 }
1081 1107
1082 /// <summary> 1108 /// <summary>
@@ -1089,16 +1115,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1089 1115
1090 try 1116 try
1091 { 1117 {
1092 //for (int y = 0; y < 16; y++) 1118 for (int y = 0; y < 16; y++)
1093 //{ 1119 {
1094 // for (int x = 0; x < 16; x++) 1120 for (int x = 0; x < 16; x+=4)
1095 // { 1121 {
1096 // SendLayerData(x, y, map); 1122 SendLayerPacket(x, y, map);
1097 // } 1123 }
1098 //} 1124 }
1099
1100 // Send LayerData in a spiral pattern. Fun!
1101 SendLayerTopRight(map, 0, 0, 15, 15);
1102 } 1125 }
1103 catch (Exception e) 1126 catch (Exception e)
1104 { 1127 {
@@ -1106,51 +1129,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1106 } 1129 }
1107 } 1130 }
1108 1131
1109 private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2)
1110 {
1111 // Row
1112 for (int i = x1; i <= x2; i++)
1113 SendLayerData(i, y1, map);
1114
1115 // Column
1116 for (int j = y1 + 1; j <= y2; j++)
1117 SendLayerData(x2, j, map);
1118
1119 if (x2 - x1 > 0)
1120 SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
1121 }
1122
1123 void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2)
1124 {
1125 // Row in reverse
1126 for (int i = x2; i >= x1; i--)
1127 SendLayerData(i, y2, map);
1128
1129 // Column in reverse
1130 for (int j = y2 - 1; j >= y1; j--)
1131 SendLayerData(x1, j, map);
1132
1133 if (x2 - x1 > 0)
1134 SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
1135 }
1136
1137 /// <summary> 1132 /// <summary>
1138 /// Sends a set of four patches (x, x+1, ..., x+3) to the client 1133 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
1139 /// </summary> 1134 /// </summary>
1140 /// <param name="map">heightmap</param> 1135 /// <param name="map">heightmap</param>
1141 /// <param name="px">X coordinate for patches 0..12</param> 1136 /// <param name="px">X coordinate for patches 0..12</param>
1142 /// <param name="py">Y coordinate for patches 0..15</param> 1137 /// <param name="py">Y coordinate for patches 0..15</param>
1143 // private void SendLayerPacket(float[] map, int y, int x) 1138 private void SendLayerPacket(int x, int y, float[] map)
1144 // { 1139 {
1145 // int[] patches = new int[4]; 1140 int[] patches = new int[4];
1146 // patches[0] = x + 0 + y * 16; 1141 patches[0] = x + 0 + y * 16;
1147 // patches[1] = x + 1 + y * 16; 1142 patches[1] = x + 1 + y * 16;
1148 // patches[2] = x + 2 + y * 16; 1143 patches[2] = x + 2 + y * 16;
1149 // patches[3] = x + 3 + y * 16; 1144 patches[3] = x + 3 + y * 16;
1150 1145
1151 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); 1146 float[] heightmap = (map.Length == 65536) ?
1152 // OutPacket(layerpack, ThrottleOutPacketType.Land); 1147 map :
1153 // } 1148 LLHeightFieldMoronize(map);
1149
1150 try
1151 {
1152 Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1153 OutPacket(layerpack, ThrottleOutPacketType.Land);
1154 }
1155 catch
1156 {
1157 for (int px = x ; px < x + 4 ; px++)
1158 SendLayerData(px, y, map);
1159 }
1160 }
1154 1161
1155 /// <summary> 1162 /// <summary>
1156 /// Sends a specified patch to a client 1163 /// Sends a specified patch to a client
@@ -1170,7 +1177,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1170 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); 1177 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1171 layerpack.Header.Reliable = true; 1178 layerpack.Header.Reliable = true;
1172 1179
1173 OutPacket(layerpack, ThrottleOutPacketType.Land); 1180 OutPacket(layerpack, ThrottleOutPacketType.Task);
1174 } 1181 }
1175 catch (Exception e) 1182 catch (Exception e)
1176 { 1183 {
@@ -2300,6 +2307,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2300 OutPacket(sound, ThrottleOutPacketType.Task); 2307 OutPacket(sound, ThrottleOutPacketType.Task);
2301 } 2308 }
2302 2309
2310 public void SendTransferAbort(TransferRequestPacket transferRequest)
2311 {
2312 TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort);
2313 abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID;
2314 abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType;
2315 m_log.Debug("[Assets] Aborting transfer; asset request failed");
2316 OutPacket(abort, ThrottleOutPacketType.Task);
2317 }
2318
2303 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) 2319 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
2304 { 2320 {
2305 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); 2321 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger);
@@ -3602,7 +3618,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3602 /// </summary> 3618 /// </summary>
3603 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) 3619 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
3604 { 3620 {
3605 //double priority = m_prioritizer.GetUpdatePriority(this, entity); 3621 if (entity is SceneObjectPart)
3622 {
3623 SceneObjectPart e = (SceneObjectPart)entity;
3624 SceneObjectGroup g = e.ParentGroup;
3625 if (g.RootPart.Shape.State > 30) // HUD
3626 if (g.OwnerID != AgentId)
3627 return; // Don't send updates for other people's HUDs
3628 }
3629
3606 uint priority = m_prioritizer.GetUpdatePriority(this, entity); 3630 uint priority = m_prioritizer.GetUpdatePriority(this, entity);
3607 3631
3608 lock (m_entityUpdates.SyncRoot) 3632 lock (m_entityUpdates.SyncRoot)
@@ -3669,211 +3693,230 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3669 3693
3670 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race 3694 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
3671 // condition where a kill can be processed before an out-of-date update for the same object. 3695 // condition where a kill can be processed before an out-of-date update for the same object.
3672 lock (m_killRecord) 3696 float avgTimeDilation = 1.0f;
3697 IEntityUpdate iupdate;
3698 Int32 timeinqueue; // this is just debugging code & can be dropped later
3699
3700 while (updatesThisCall < maxUpdates)
3673 { 3701 {
3674 float avgTimeDilation = 1.0f; 3702 lock (m_entityUpdates.SyncRoot)
3675 IEntityUpdate iupdate; 3703 if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue))
3676 Int32 timeinqueue; // this is just debugging code & can be dropped later 3704 break;
3677
3678 while (updatesThisCall < maxUpdates)
3679 {
3680 lock (m_entityUpdates.SyncRoot)
3681 if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue))
3682 break;
3683 3705
3684 EntityUpdate update = (EntityUpdate)iupdate; 3706 EntityUpdate update = (EntityUpdate)iupdate;
3685 3707
3686 avgTimeDilation += update.TimeDilation; 3708 avgTimeDilation += update.TimeDilation;
3687 avgTimeDilation *= 0.5f; 3709 avgTimeDilation *= 0.5f;
3688 3710
3689 if (update.Entity is SceneObjectPart) 3711 if (update.Entity is SceneObjectPart)
3712 {
3713 SceneObjectPart part = (SceneObjectPart)update.Entity;
3714
3715 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
3716 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good
3717 // safety measure.
3718 //
3719 // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
3720 // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
3721 // updates and kills on different threads with different scheduling strategies, hence this protection.
3722 //
3723 // This doesn't appear to apply to child prims - a client will happily ignore these updates
3724 // after the root prim has been deleted.
3725 lock (m_killRecord)
3690 { 3726 {
3691 SceneObjectPart part = (SceneObjectPart)update.Entity;
3692
3693 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
3694 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good
3695 // safety measure.
3696 //
3697 // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
3698 // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
3699 // updates and kills on different threads with different scheduling strategies, hence this protection.
3700 //
3701 // This doesn't appear to apply to child prims - a client will happily ignore these updates
3702 // after the root prim has been deleted.
3703 if (m_killRecord.Contains(part.LocalId)) 3727 if (m_killRecord.Contains(part.LocalId))
3704 {
3705 // m_log.WarnFormat(
3706 // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted",
3707 // part.LocalId, Name);
3708 continue; 3728 continue;
3709 } 3729 if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId))
3710 3730 continue;
3711 if (part.ParentGroup.IsAttachment && m_disableFacelights) 3731 }
3732
3733 if (part.ParentGroup.IsDeleted)
3734 continue;
3735
3736 if (part.ParentGroup.IsAttachment)
3737 { // Someone else's HUD, why are we getting these?
3738 if (part.ParentGroup.OwnerID != AgentId &&
3739 part.ParentGroup.RootPart.Shape.State >= 30)
3740 continue;
3741 ScenePresence sp;
3742 // Owner is not in the sim, don't update it to
3743 // anyone
3744 if (!m_scene.TryGetScenePresence(part.OwnerID, out sp))
3745 continue;
3746
3747 List<SceneObjectGroup> atts = sp.GetAttachments();
3748 bool found = false;
3749 foreach (SceneObjectGroup att in atts)
3712 { 3750 {
3713 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && 3751 if (att == part.ParentGroup)
3714 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
3715 { 3752 {
3716 part.Shape.LightEntry = false; 3753 found = true;
3754 break;
3717 } 3755 }
3718 } 3756 }
3757
3758 // It's an attachment of a valid avatar, but
3759 // doesn't seem to be attached, skip
3760 if (!found)
3761 continue;
3719 } 3762 }
3720 3763 if (part.ParentGroup.IsAttachment && m_disableFacelights)
3721 ++updatesThisCall;
3722
3723 #region UpdateFlags to packet type conversion
3724
3725 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
3726
3727 bool canUseCompressed = true;
3728 bool canUseImproved = true;
3729
3730 // Compressed object updates only make sense for LL primitives
3731 if (!(update.Entity is SceneObjectPart))
3732 {
3733 canUseCompressed = false;
3734 }
3735
3736 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
3737 {
3738 canUseCompressed = false;
3739 canUseImproved = false;
3740 }
3741 else
3742 { 3764 {
3743 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || 3765 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
3744 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || 3766 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
3745 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
3746 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3747 {
3748 canUseCompressed = false;
3749 }
3750
3751 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
3752 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
3753 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
3754 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
3755 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
3756 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
3757 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
3758 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
3759 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
3760 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
3761 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
3762 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
3763 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
3764 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3765 { 3767 {
3766 canUseImproved = false; 3768 part.Shape.LightEntry = false;
3767 } 3769 }
3768 } 3770 }
3769 3771 }
3770 #endregion UpdateFlags to packet type conversion 3772
3771 3773 ++updatesThisCall;
3772 #region Block Construction 3774
3773 3775 #region UpdateFlags to packet type conversion
3774 // TODO: Remove this once we can build compressed updates 3776
3777 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
3778
3779 bool canUseCompressed = true;
3780 bool canUseImproved = true;
3781
3782 // Compressed object updates only make sense for LL primitives
3783 if (!(update.Entity is SceneObjectPart))
3784 {
3775 canUseCompressed = false; 3785 canUseCompressed = false;
3776 3786 }
3777 if (!canUseImproved && !canUseCompressed) 3787
3778 { 3788 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
3779 if (update.Entity is ScenePresence) 3789 {
3780 { 3790 canUseCompressed = false;
3781 objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); 3791 canUseImproved = false;
3782 objectUpdates.Value.Add(update); 3792 }
3783 } 3793 else
3784 else 3794 {
3785 { 3795 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) ||
3786 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); 3796 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
3787 objectUpdates.Value.Add(update); 3797 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
3788 } 3798 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3789 }
3790 else if (!canUseImproved)
3791 { 3799 {
3792 compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); 3800 canUseCompressed = false;
3793 compressedUpdates.Value.Add(update);
3794 } 3801 }
3795 else 3802
3803 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
3804 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
3805 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
3806 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
3807 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
3808 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
3809 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
3810 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
3811 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
3812 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
3813 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
3814 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
3815 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
3816 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3796 { 3817 {
3797 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) 3818 canUseImproved = false;
3798 {
3799 // Self updates go into a special list
3800 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3801 terseAgentUpdates.Value.Add(update);
3802 }
3803 else
3804 {
3805 // Everything else goes here
3806 terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3807 terseUpdates.Value.Add(update);
3808 }
3809 } 3819 }
3810
3811 #endregion Block Construction
3812 } 3820 }
3813
3814
3815 #region Packet Sending
3816 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
3817 3821
3818 if (terseAgentUpdateBlocks.IsValueCreated) 3822 #endregion UpdateFlags to packet type conversion
3819 {
3820 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
3821 3823
3822 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 3824 #region Block Construction
3823 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3824 packet.RegionData.TimeDilation = timeDilation;
3825 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3826 3825
3827 for (int i = 0; i < blocks.Count; i++) 3826 // TODO: Remove this once we can build compressed updates
3828 packet.ObjectData[i] = blocks[i]; 3827 canUseCompressed = false;
3829 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3830 OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); });
3831 }
3832 3828
3833 if (objectUpdateBlocks.IsValueCreated) 3829 if (!canUseImproved && !canUseCompressed)
3834 { 3830 {
3835 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; 3831 if (update.Entity is ScenePresence)
3836 3832 {
3837 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); 3833 objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
3838 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3834 }
3839 packet.RegionData.TimeDilation = timeDilation; 3835 else
3840 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 3836 {
3841 3837 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
3842 for (int i = 0; i < blocks.Count; i++) 3838 }
3843 packet.ObjectData[i] = blocks[i];
3844 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3845 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); });
3846 } 3839 }
3847 3840 else if (!canUseImproved)
3848 if (compressedUpdateBlocks.IsValueCreated)
3849 { 3841 {
3850 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; 3842 compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags));
3851
3852 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
3853 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3854 packet.RegionData.TimeDilation = timeDilation;
3855 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
3856
3857 for (int i = 0; i < blocks.Count; i++)
3858 packet.ObjectData[i] = blocks[i];
3859 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3860 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); });
3861 } 3843 }
3862 3844 else
3863 if (terseUpdateBlocks.IsValueCreated)
3864 { 3845 {
3865 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; 3846 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId)
3866 3847 // Self updates go into a special list
3867 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 3848 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3868 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3849 else
3869 packet.RegionData.TimeDilation = timeDilation; 3850 // Everything else goes here
3870 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 3851 terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3871
3872 for (int i = 0; i < blocks.Count; i++)
3873 packet.ObjectData[i] = blocks[i];
3874 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3875 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
3876 } 3852 }
3853
3854 #endregion Block Construction
3855 }
3856
3857 #region Packet Sending
3858
3859 const float TIME_DILATION = 1.0f;
3860 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
3861
3862 if (terseAgentUpdateBlocks.IsValueCreated)
3863 {
3864 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
3865
3866 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
3867 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3868 packet.RegionData.TimeDilation = timeDilation;
3869 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3870
3871 for (int i = 0; i < blocks.Count; i++)
3872 packet.ObjectData[i] = blocks[i];
3873
3874 OutPacket(packet, ThrottleOutPacketType.Unknown, true);
3875 }
3876
3877 if (objectUpdateBlocks.IsValueCreated)
3878 {
3879 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
3880
3881 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
3882 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3883 packet.RegionData.TimeDilation = timeDilation;
3884 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3885
3886 for (int i = 0; i < blocks.Count; i++)
3887 packet.ObjectData[i] = blocks[i];
3888
3889 OutPacket(packet, ThrottleOutPacketType.Task, true);
3890 }
3891
3892 if (compressedUpdateBlocks.IsValueCreated)
3893 {
3894 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
3895
3896 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
3897 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3898 packet.RegionData.TimeDilation = timeDilation;
3899 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
3900
3901 for (int i = 0; i < blocks.Count; i++)
3902 packet.ObjectData[i] = blocks[i];
3903
3904 OutPacket(packet, ThrottleOutPacketType.Task, true);
3905 }
3906
3907 if (terseUpdateBlocks.IsValueCreated)
3908 {
3909 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
3910
3911 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
3912 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3913 packet.RegionData.TimeDilation = timeDilation;
3914 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3915
3916 for (int i = 0; i < blocks.Count; i++)
3917 packet.ObjectData[i] = blocks[i];
3918
3919 OutPacket(packet, ThrottleOutPacketType.Task, true);
3877 } 3920 }
3878 3921
3879 #endregion Packet Sending 3922 #endregion Packet Sending
@@ -4174,11 +4217,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4174 4217
4175 // Pass in the delegate so that if this packet needs to be resent, we send the current properties 4218 // Pass in the delegate so that if this packet needs to be resent, we send the current properties
4176 // of the object rather than the properties when the packet was created 4219 // of the object rather than the properties when the packet was created
4177 OutPacket(packet, ThrottleOutPacketType.Task, true, 4220 // HACK : Remove intelligent resending until it's fixed in core
4178 delegate(OutgoingPacket oPacket) 4221 //OutPacket(packet, ThrottleOutPacketType.Task, true,
4179 { 4222 // delegate(OutgoingPacket oPacket)
4180 ResendPropertyUpdates(updates, oPacket); 4223 // {
4181 }); 4224 // ResendPropertyUpdates(updates, oPacket);
4225 // });
4226 OutPacket(packet, ThrottleOutPacketType.Task, true);
4182 4227
4183 // pbcnt += blocks.Count; 4228 // pbcnt += blocks.Count;
4184 // ppcnt++; 4229 // ppcnt++;
@@ -4204,11 +4249,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4204 // of the object rather than the properties when the packet was created 4249 // of the object rather than the properties when the packet was created
4205 List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); 4250 List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>();
4206 updates.Add(familyUpdates.Value[i]); 4251 updates.Add(familyUpdates.Value[i]);
4207 OutPacket(packet, ThrottleOutPacketType.Task, true, 4252 // HACK : Remove intelligent resending until it's fixed in core
4208 delegate(OutgoingPacket oPacket) 4253 //OutPacket(packet, ThrottleOutPacketType.Task, true,
4209 { 4254 // delegate(OutgoingPacket oPacket)
4210 ResendPropertyUpdates(updates, oPacket); 4255 // {
4211 }); 4256 // ResendPropertyUpdates(updates, oPacket);
4257 // });
4258 OutPacket(packet, ThrottleOutPacketType.Task, true);
4212 4259
4213 // fpcnt++; 4260 // fpcnt++;
4214 // fbcnt++; 4261 // fbcnt++;
@@ -4357,37 +4404,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4357 if (bl[i].BannedUserID == UUID.Zero) 4404 if (bl[i].BannedUserID == UUID.Zero)
4358 continue; 4405 continue;
4359 BannedUsers.Add(bl[i].BannedUserID); 4406 BannedUsers.Add(bl[i].BannedUserID);
4360 }
4361 4407
4362 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); 4408 if (BannedUsers.Count >= 50 || (i == (bl.Length - 1) && BannedUsers.Count > 0))
4363 packet.AgentData.TransactionID = UUID.Random(); 4409 {
4364 packet.AgentData.AgentID = AgentId; 4410 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
4365 packet.AgentData.SessionID = SessionId; 4411 packet.AgentData.TransactionID = UUID.Random();
4366 packet.MethodData.Invoice = invoice; 4412 packet.AgentData.AgentID = AgentId;
4367 packet.MethodData.Method = Utils.StringToBytes("setaccess"); 4413 packet.AgentData.SessionID = SessionId;
4414 packet.MethodData.Invoice = invoice;
4415 packet.MethodData.Method = Utils.StringToBytes("setaccess");
4368 4416
4369 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count]; 4417 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count];
4370 4418
4371 for (int i = 0; i < (6 + BannedUsers.Count); i++) 4419 int j;
4372 { 4420 for (j = 0; j < (6 + BannedUsers.Count); j++)
4373 returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); 4421 {
4374 } 4422 returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock();
4375 int j = 0; 4423 }
4424 j = 0;
4376 4425
4377 returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; 4426 returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++;
4378 returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; 4427 returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++;
4379 returnblock[j].Parameter = Utils.StringToBytes("0"); j++; 4428 returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
4380 returnblock[j].Parameter = Utils.StringToBytes("0"); j++; 4429 returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
4381 returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++; 4430 returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++;
4382 returnblock[j].Parameter = Utils.StringToBytes("0"); j++; 4431 returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
4383 4432
4384 foreach (UUID banned in BannedUsers) 4433 foreach (UUID banned in BannedUsers)
4385 { 4434 {
4386 returnblock[j].Parameter = banned.GetBytes(); j++; 4435 returnblock[j].Parameter = banned.GetBytes(); j++;
4436 }
4437 packet.ParamList = returnblock;
4438 packet.Header.Reliable = true;
4439 OutPacket(packet, ThrottleOutPacketType.Task);
4440
4441 BannedUsers.Clear();
4442 }
4387 } 4443 }
4388 packet.ParamList = returnblock; 4444
4389 packet.Header.Reliable = false;
4390 OutPacket(packet, ThrottleOutPacketType.Task);
4391 } 4445 }
4392 4446
4393 public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) 4447 public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
@@ -4556,7 +4610,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4556 4610
4557 if (landData.SimwideArea > 0) 4611 if (landData.SimwideArea > 0)
4558 { 4612 {
4559 int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 4613 int simulatorCapacity = (int)((double)(landData.SimwideArea * m_scene.RegionInfo.ObjectCapacity) * m_scene.RegionInfo.RegionSettings.ObjectBonus) / 65536;
4614 // Never report more than sim total capacity
4615 if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity)
4616 simulatorCapacity = m_scene.RegionInfo.ObjectCapacity;
4560 updateMessage.SimWideMaxPrims = simulatorCapacity; 4617 updateMessage.SimWideMaxPrims = simulatorCapacity;
4561 } 4618 }
4562 else 4619 else
@@ -4685,14 +4742,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4685 4742
4686 if (notifyCount > 0) 4743 if (notifyCount > 0)
4687 { 4744 {
4688 if (notifyCount > 32) 4745// if (notifyCount > 32)
4689 { 4746// {
4690 m_log.InfoFormat( 4747// m_log.InfoFormat(
4691 "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" 4748// "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}"
4692 + " - a developer might want to investigate whether this is a hard limit", 32); 4749// + " - a developer might want to investigate whether this is a hard limit", 32);
4693 4750//
4694 notifyCount = 32; 4751// notifyCount = 32;
4695 } 4752// }
4696 4753
4697 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock 4754 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock
4698 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; 4755 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount];
@@ -5226,6 +5283,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5226 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); 5283 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false);
5227 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); 5284 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false);
5228 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); 5285 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode);
5286 AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments);
5229 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); 5287 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false);
5230 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); 5288 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents);
5231 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); 5289 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery);
@@ -5327,6 +5385,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5327 (x.CameraLeftAxis != lastarg.CameraLeftAxis) || 5385 (x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
5328 (x.CameraUpAxis != lastarg.CameraUpAxis) || 5386 (x.CameraUpAxis != lastarg.CameraUpAxis) ||
5329 (x.ControlFlags != lastarg.ControlFlags) || 5387 (x.ControlFlags != lastarg.ControlFlags) ||
5388 (x.ControlFlags != 0) ||
5330 (x.Far != lastarg.Far) || 5389 (x.Far != lastarg.Far) ||
5331 (x.Flags != lastarg.Flags) || 5390 (x.Flags != lastarg.Flags) ||
5332 (x.State != lastarg.State) || 5391 (x.State != lastarg.State) ||
@@ -5704,7 +5763,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5704 args.Channel = ch; 5763 args.Channel = ch;
5705 args.From = String.Empty; 5764 args.From = String.Empty;
5706 args.Message = Utils.BytesToString(msg); 5765 args.Message = Utils.BytesToString(msg);
5707 args.Type = ChatTypeEnum.Shout; 5766 args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance
5708 args.Position = new Vector3(); 5767 args.Position = new Vector3();
5709 args.Scene = Scene; 5768 args.Scene = Scene;
5710 args.Sender = this; 5769 args.Sender = this;
@@ -9710,7 +9769,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9710 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, 9769 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID,
9711 Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), 9770 Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName),
9712 UpdateMuteListEntry.MuteData.MuteType, 9771 UpdateMuteListEntry.MuteData.MuteType,
9713 UpdateMuteListEntry.AgentData.AgentID); 9772 UpdateMuteListEntry.MuteData.MuteFlags);
9714 return true; 9773 return true;
9715 } 9774 }
9716 return false; 9775 return false;
@@ -9725,8 +9784,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9725 { 9784 {
9726 handlerRemoveMuteListEntry(this, 9785 handlerRemoveMuteListEntry(this,
9727 RemoveMuteListEntry.MuteData.MuteID, 9786 RemoveMuteListEntry.MuteData.MuteID,
9728 Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), 9787 Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName));
9729 RemoveMuteListEntry.AgentData.AgentID);
9730 return true; 9788 return true;
9731 } 9789 }
9732 return false; 9790 return false;
@@ -9774,6 +9832,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9774 { 9832 {
9775 return true; 9833 return true;
9776 } 9834 }
9835
9836 private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack)
9837 {
9838 CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack;
9839
9840 #region Packet Session and User Check
9841 if (m_checkPackets)
9842 {
9843 if (packet.AgentData.SessionID != SessionId ||
9844 packet.AgentData.AgentID != AgentId)
9845 return true;
9846 }
9847 #endregion
9848 MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null;
9849 List<InventoryItemBase> items = new List<InventoryItemBase>();
9850 foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData)
9851 {
9852 InventoryItemBase b = new InventoryItemBase();
9853 b.ID = n.OldItemID;
9854 b.Folder = n.OldFolderID;
9855 items.Add(b);
9856 }
9857
9858 handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy;
9859 if (handlerMoveItemsAndLeaveCopy != null)
9860 {
9861 handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID);
9862 }
9863
9864 return true;
9865 }
9777 9866
9778 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) 9867 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack)
9779 { 9868 {
@@ -10200,6 +10289,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10200 groupProfileReply.GroupData.MaturePublish = d.MaturePublish; 10289 groupProfileReply.GroupData.MaturePublish = d.MaturePublish;
10201 groupProfileReply.GroupData.OwnerRole = d.OwnerRole; 10290 groupProfileReply.GroupData.OwnerRole = d.OwnerRole;
10202 10291
10292 Scene scene = (Scene)m_scene;
10293 if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID)))
10294 {
10295 ScenePresence p;
10296 if (scene.TryGetScenePresence(sender.AgentId, out p))
10297 {
10298 if (p.GodLevel >= 200)
10299 {
10300 groupProfileReply.GroupData.OpenEnrollment = true;
10301 groupProfileReply.GroupData.MembershipFee = 0;
10302 }
10303 }
10304 }
10305
10203 OutPacket(groupProfileReply, ThrottleOutPacketType.Task); 10306 OutPacket(groupProfileReply, ThrottleOutPacketType.Task);
10204 } 10307 }
10205 return true; 10308 return true;
@@ -10772,11 +10875,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10772 10875
10773 StartLure handlerStartLure = OnStartLure; 10876 StartLure handlerStartLure = OnStartLure;
10774 if (handlerStartLure != null) 10877 if (handlerStartLure != null)
10775 handlerStartLure(startLureRequest.Info.LureType, 10878 {
10776 Utils.BytesToString( 10879 for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++)
10777 startLureRequest.Info.Message), 10880 {
10778 startLureRequest.TargetData[0].TargetID, 10881 handlerStartLure(startLureRequest.Info.LureType,
10779 this); 10882 Utils.BytesToString(
10883 startLureRequest.Info.Message),
10884 startLureRequest.TargetData[i].TargetID,
10885 this);
10886 }
10887 }
10780 return true; 10888 return true;
10781 } 10889 }
10782 private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) 10890 private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack)
@@ -10890,10 +10998,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10890 } 10998 }
10891 #endregion 10999 #endregion
10892 11000
10893 ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; 11001 ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete;
10894 if (handlerClassifiedGodDelete != null) 11002 if (handlerClassifiedGodDelete != null)
10895 handlerClassifiedGodDelete( 11003 handlerClassifiedGodDelete(
10896 classifiedGodDelete.Data.ClassifiedID, 11004 classifiedGodDelete.Data.ClassifiedID,
11005 classifiedGodDelete.Data.QueryID,
10897 this); 11006 this);
10898 return true; 11007 return true;
10899 } 11008 }
@@ -11923,7 +12032,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11923 12032
11924// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); 12033// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
11925 12034
12035
12036 //Note, the bool returned from the below function is useless since it is always false.
11926 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); 12037 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
12038
11927 } 12039 }
11928 12040
11929 /// <summary> 12041 /// <summary>
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index ffa3be4..c951071 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -158,6 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
158 158
159 private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC 159 private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC
160 private int m_maxRTO = 60000; 160 private int m_maxRTO = 60000;
161 public bool m_deliverPackets = true;
161 162
162 /// <summary> 163 /// <summary>
163 /// Default constructor 164 /// Default constructor
@@ -439,6 +440,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
439 if (category >= 0 && category < m_packetOutboxes.Length) 440 if (category >= 0 && category < m_packetOutboxes.Length)
440 { 441 {
441 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category]; 442 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
443
444 if (m_deliverPackets == false)
445 {
446 queue.Enqueue(packet);
447 return true;
448 }
449
442 TokenBucket bucket = m_throttleCategories[category]; 450 TokenBucket bucket = m_throttleCategories[category];
443 451
444 // Don't send this packet if there is already a packet waiting in the queue 452 // Don't send this packet if there is already a packet waiting in the queue
@@ -488,6 +496,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
488 /// <returns>True if any packets were sent, otherwise false</returns> 496 /// <returns>True if any packets were sent, otherwise false</returns>
489 public bool DequeueOutgoing() 497 public bool DequeueOutgoing()
490 { 498 {
499 if (m_deliverPackets == false) return false;
500
491 OutgoingPacket packet; 501 OutgoingPacket packet;
492 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue; 502 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue;
493 TokenBucket bucket; 503 TokenBucket bucket;
@@ -520,7 +530,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
520 // No dequeued packet waiting to be sent, try to pull one off 530 // No dequeued packet waiting to be sent, try to pull one off
521 // this queue 531 // this queue
522 queue = m_packetOutboxes[i]; 532 queue = m_packetOutboxes[i];
523 if (queue.Dequeue(out packet)) 533 if (queue != null && queue.Dequeue(out packet))
524 { 534 {
525 // A packet was pulled off the queue. See if we have 535 // A packet was pulled off the queue. See if we have
526 // enough tokens in the bucket to send it out 536 // enough tokens in the bucket to send it out
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index ccad241..ae8251a 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -991,7 +991,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
991 if (m_scene.TryGetClient(udpClient.AgentID, out client)) 991 if (m_scene.TryGetClient(udpClient.AgentID, out client))
992 { 992 {
993 client.IsLoggingOut = true; 993 client.IsLoggingOut = true;
994 client.Close(); 994 client.Close(false);
995 } 995 }
996 } 996 }
997 997
@@ -1003,6 +1003,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1003 1003
1004 while (base.IsRunning) 1004 while (base.IsRunning)
1005 { 1005 {
1006 m_scene.ThreadAlive(1);
1006 try 1007 try
1007 { 1008 {
1008 IncomingPacket incomingPacket = null; 1009 IncomingPacket incomingPacket = null;
@@ -1045,6 +1046,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1045 1046
1046 while (base.IsRunning) 1047 while (base.IsRunning)
1047 { 1048 {
1049 m_scene.ThreadAlive(2);
1048 try 1050 try
1049 { 1051 {
1050 m_packetSent = false; 1052 m_packetSent = false;
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
index 6eebd9d..d2779ba 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
@@ -100,10 +100,6 @@ namespace OpenMetaverse
100 const int SIO_UDP_CONNRESET = -1744830452; 100 const int SIO_UDP_CONNRESET = -1744830452;
101 101
102 IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort); 102 IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort);
103
104 m_log.DebugFormat(
105 "[UDPBASE]: Binding UDP listener using internal IP address config {0}:{1}",
106 ipep.Address, ipep.Port);
107 103
108 m_udpSocket = new Socket( 104 m_udpSocket = new Socket(
109 AddressFamily.InterNetwork, 105 AddressFamily.InterNetwork,