aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs242
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs36
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs76
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs52
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs82
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs10
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs8
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs44
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs8
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs58
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs6
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs52
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs14
15 files changed, 347 insertions, 347 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index 15d6f7f..0a6785c 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
@@ -98,7 +98,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
98 } 98 }
99 99
100 /// <summary> 100 /// <summary>
101 /// Sends packets for this texture to a client until packetsToSend is 101 /// Sends packets for this texture to a client until packetsToSend is
102 /// hit or the transfer completes 102 /// hit or the transfer completes
103 /// </summary> 103 /// </summary>
104 /// <param name="client">Reference to the client that the packets are destined for</param> 104 /// <param name="client">Reference to the client that the packets are destined for</param>
@@ -198,7 +198,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
198 m_currentPacket = m_stopPacket; 198 m_currentPacket = m_stopPacket;
199 return; 199 return;
200 } 200 }
201 201
202 if (DiscardLevel >= 0 || m_stopPacket == 0) 202 if (DiscardLevel >= 0 || m_stopPacket == 0)
203 { 203 {
204 // This shouldn't happen, but if it does, we really can't proceed 204 // This shouldn't happen, but if it does, we really can't proceed
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 27ca740..dba2872 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -434,7 +434,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
434 /// Entity update queues 434 /// Entity update queues
435 /// </summary> 435 /// </summary>
436 public PriorityQueue EntityUpdateQueue { get { return m_entityUpdates; } } 436 public PriorityQueue EntityUpdateQueue { get { return m_entityUpdates; } }
437 437
438 /// <summary> 438 /// <summary>
439 /// First name of the agent/avatar represented by the client 439 /// First name of the agent/avatar represented by the client
440 /// </summary> 440 /// </summary>
@@ -478,7 +478,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
478 public List<uint> SelectedObjects {get; private set;} 478 public List<uint> SelectedObjects {get; private set;}
479 479
480 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } 480 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } }
481 481
482 482
483 #endregion Properties 483 #endregion Properties
484 484
@@ -554,7 +554,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
554 // there is some unidentified connection problem, not where we have issues due to deadlock 554 // there is some unidentified connection problem, not where we have issues due to deadlock
555 if (!IsActive && !force) 555 if (!IsActive && !force)
556 { 556 {
557 m_log.DebugFormat( "{0} Not attempting to close inactive client {1} in {2} since force flag is not set", 557 m_log.DebugFormat( "{0} Not attempting to close inactive client {1} in {2} since force flag is not set",
558 LogHeader, Name, m_scene.Name); 558 LogHeader, Name, m_scene.Name);
559 559
560 return; 560 return;
@@ -713,13 +713,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
713 /// <param name="packetType"></param> 713 /// <param name="packetType"></param>
714 /// <param name="handler"></param> 714 /// <param name="handler"></param>
715 /// <param name="doAsync"> 715 /// <param name="doAsync">
716 /// If true, when the packet is received handle it on a different thread. Whether this is given direct to 716 /// If true, when the packet is received handle it on a different thread. Whether this is given direct to
717 /// a threadpool thread or placed in a queue depends on the inEngine parameter. 717 /// a threadpool thread or placed in a queue depends on the inEngine parameter.
718 /// </param> 718 /// </param>
719 /// <param name="inEngine"> 719 /// <param name="inEngine">
720 /// If async is false then this parameter is ignored. 720 /// If async is false then this parameter is ignored.
721 /// If async is true and inEngine is false, then the packet is sent directly to a 721 /// If async is true and inEngine is false, then the packet is sent directly to a
722 /// threadpool thread. 722 /// threadpool thread.
723 /// If async is true and inEngine is true, then the packet is sent to the IncomingPacketAsyncHandlingEngine. 723 /// If async is true and inEngine is true, then the packet is sent to the IncomingPacketAsyncHandlingEngine.
724 /// This may result in slower handling but reduces the risk of overloading the simulator when there are many 724 /// This may result in slower handling but reduces the risk of overloading the simulator when there are many
725 /// simultaneous async requests. 725 /// simultaneous async requests.
@@ -820,7 +820,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
820 public void ProcessSpecificPacketAsync(object state) 820 public void ProcessSpecificPacketAsync(object state)
821 { 821 {
822 AsyncPacketProcess packetObject = (AsyncPacketProcess)state; 822 AsyncPacketProcess packetObject = (AsyncPacketProcess)state;
823 823
824 try 824 try
825 { 825 {
826 packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack); 826 packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack);
@@ -830,7 +830,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
830 // Make sure that we see any exception caused by the asynchronous operation. 830 // Make sure that we see any exception caused by the asynchronous operation.
831 m_log.Error( 831 m_log.Error(
832 string.Format( 832 string.Format(
833 "[LLCLIENTVIEW]: Caught exception while processing {0} for {1} ", packetObject.Pack, Name), 833 "[LLCLIENTVIEW]: Caught exception while processing {0} for {1} ", packetObject.Pack, Name),
834 e); 834 e);
835 } 835 }
836 } 836 }
@@ -976,7 +976,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
976 if (im.imSessionID == UUID.Zero.Guid) 976 if (im.imSessionID == UUID.Zero.Guid)
977 msg.MessageBlock.ID = new UUID(im.fromAgentID) ^ new UUID(im.toAgentID); 977 msg.MessageBlock.ID = new UUID(im.fromAgentID) ^ new UUID(im.toAgentID);
978 else 978 else
979 msg.MessageBlock.ID = new UUID(im.imSessionID); 979 msg.MessageBlock.ID = new UUID(im.imSessionID);
980 msg.MessageBlock.Offline = im.offline; 980 msg.MessageBlock.Offline = im.offline;
981 msg.MessageBlock.ParentEstateID = im.ParentEstateID; 981 msg.MessageBlock.ParentEstateID = im.ParentEstateID;
982 msg.MessageBlock.Position = im.Position; 982 msg.MessageBlock.Position = im.Position;
@@ -1301,7 +1301,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1301 1301
1302 // Legacy form of invocation that passes around a bare data array. 1302 // Legacy form of invocation that passes around a bare data array.
1303 // Just ignore what was passed and use the real terrain info that is part of the scene. 1303 // Just ignore what was passed and use the real terrain info that is part of the scene.
1304 // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI, 1304 // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI,
1305 // there is a special form for specifying multiple terrain patches to send. 1305 // there is a special form for specifying multiple terrain patches to send.
1306 // The form is to pass 'px' as negative the number of patches to send and to 1306 // The form is to pass 'px' as negative the number of patches to send and to
1307 // pass the float array as pairs of patch X and Y coordinates. So, passing 'px' 1307 // pass the float array as pairs of patch X and Y coordinates. So, passing 'px'
@@ -1396,7 +1396,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1396 public virtual void SendWindData(int version, Vector2[] windSpeeds) 1396 public virtual void SendWindData(int version, Vector2[] windSpeeds)
1397 { 1397 {
1398// Vector2[] windSpeeds = (Vector2[])o; 1398// Vector2[] windSpeeds = (Vector2[])o;
1399 1399
1400 ulong handle = this.Scene.RegionInfo.RegionHandle; 1400 ulong handle = this.Scene.RegionInfo.RegionHandle;
1401 bool isNewData; 1401 bool isNewData;
1402 lock(lastWindPackets) 1402 lock(lastWindPackets)
@@ -1780,7 +1780,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1780 m_entityUpdates.Remove(localIDs); 1780 m_entityUpdates.Remove(localIDs);
1781 1781
1782 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); 1782 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
1783 1783
1784 int perpacket = localIDs.Count; 1784 int perpacket = localIDs.Count;
1785 if(perpacket > 200) 1785 if(perpacket > 200)
1786 perpacket = 200; 1786 perpacket = 200;
@@ -2545,7 +2545,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2545 for (int i = 0; i < buttonlabels.Length; i++) 2545 for (int i = 0; i < buttonlabels.Length; i++)
2546 { 2546 {
2547 buttons[i] = new ScriptDialogPacket.ButtonsBlock(); 2547 buttons[i] = new ScriptDialogPacket.ButtonsBlock();
2548 buttons[i].ButtonLabel = Util.StringToBytes(buttonlabels[i],24); 2548 buttons[i].ButtonLabel = Util.StringToBytes(buttonlabels[i],24);
2549 } 2549 }
2550 dialog.Buttons = buttons; 2550 dialog.Buttons = buttons;
2551 2551
@@ -2863,15 +2863,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2863 public void SendSelectedPartsProprieties(List<ISceneEntity> parts) 2863 public void SendSelectedPartsProprieties(List<ISceneEntity> parts)
2864 { 2864 {
2865/* not in use 2865/* not in use
2866 // udp part 2866 // udp part
2867 ObjectPropertiesPacket packet = 2867 ObjectPropertiesPacket packet =
2868 (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); 2868 (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
2869 ObjectPropertiesPacket.ObjectDataBlock[] ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[parts.Count]; 2869 ObjectPropertiesPacket.ObjectDataBlock[] ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[parts.Count];
2870 2870
2871 int i = 0; 2871 int i = 0;
2872 foreach(SceneObjectPart sop in parts) 2872 foreach(SceneObjectPart sop in parts)
2873 ObjectData[i++] = CreateObjectPropertiesBlock(sop); 2873 ObjectData[i++] = CreateObjectPropertiesBlock(sop);
2874 2874
2875 packet.ObjectData = ObjectData; 2875 packet.ObjectData = ObjectData;
2876 packet.Header.Zerocoded = true; 2876 packet.Header.Zerocoded = true;
2877 // udp send splits this mega packets correctly 2877 // udp send splits this mega packets correctly
@@ -3003,13 +3003,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3003 isWearable = ((AssetType) req.AssetInf.Type == 3003 isWearable = ((AssetType) req.AssetInf.Type ==
3004 AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing); 3004 AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing);
3005 3005
3006 3006
3007 //m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); 3007 //m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable);
3008 3008
3009 3009
3010 //if (isWearable) 3010 //if (isWearable)
3011 // m_log.Debug((AssetType)req.AssetInf.Type); 3011 // m_log.Debug((AssetType)req.AssetInf.Type);
3012 3012
3013 TransferInfoPacket Transfer = new TransferInfoPacket(); 3013 TransferInfoPacket Transfer = new TransferInfoPacket();
3014 Transfer.TransferInfo.ChannelType = 2; 3014 Transfer.TransferInfo.ChannelType = 2;
3015 Transfer.TransferInfo.Status = 0; 3015 Transfer.TransferInfo.Status = 0;
@@ -3537,7 +3537,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3537 { 3537 {
3538 if(avatarID != AgentId) 3538 if(avatarID != AgentId)
3539 m_log.Debug("[CLIENT]: SendAgentGroupDataUpdate avatarID != AgentId"); 3539 m_log.Debug("[CLIENT]: SendAgentGroupDataUpdate avatarID != AgentId");
3540 3540
3541 IEventQueue eq = this.Scene.RequestModuleInterface<IEventQueue>(); 3541 IEventQueue eq = this.Scene.RequestModuleInterface<IEventQueue>();
3542 if(eq != null) 3542 if(eq != null)
3543 { 3543 {
@@ -3862,7 +3862,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3862 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; 3862 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count];
3863 AgentWearablesUpdatePacket.WearableDataBlock awb; 3863 AgentWearablesUpdatePacket.WearableDataBlock awb;
3864 int idx = 0; 3864 int idx = 0;
3865 3865
3866 for (int i = 0; i < wearables.Length; i++) 3866 for (int i = 0; i < wearables.Length; i++)
3867 { 3867 {
3868 for (int j = 0; j < wearables[i].Count; j++) 3868 for (int j = 0; j < wearables[i].Count; j++)
@@ -3878,7 +3878,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3878 // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", 3878 // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}",
3879 // awb.ItemID, awb.AssetID, i, Name); 3879 // awb.ItemID, awb.AssetID, i, Name);
3880 } 3880 }
3881 } 3881 }
3882 3882
3883 OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); 3883 OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
3884 } 3884 }
@@ -3955,7 +3955,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3955// m_log.DebugFormat( 3955// m_log.DebugFormat(
3956// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}", 3956// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}",
3957// avatar.Name, avatar.UUID, Name, AgentId); 3957// avatar.Name, avatar.UUID, Name, AgentId);
3958 3958
3959 ScenePresence presence = avatar as ScenePresence; 3959 ScenePresence presence = avatar as ScenePresence;
3960 if (presence == null) 3960 if (presence == null)
3961 return; 3961 return;
@@ -3965,7 +3965,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3965 3965
3966 objupdate.RegionData.RegionHandle = presence.RegionHandle; 3966 objupdate.RegionData.RegionHandle = presence.RegionHandle;
3967// objupdate.RegionData.TimeDilation = ushort.MaxValue; 3967// objupdate.RegionData.TimeDilation = ushort.MaxValue;
3968 objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); 3968 objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
3969 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 3969 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
3970 objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence); 3970 objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
3971 3971
@@ -4021,7 +4021,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4021 4021
4022 #region Primitive Packet/Data Sending Methods 4022 #region Primitive Packet/Data Sending Methods
4023 4023
4024 4024
4025 /// <summary> 4025 /// <summary>
4026 /// Generate one of the object update packets based on PrimUpdateFlags 4026 /// Generate one of the object update packets based on PrimUpdateFlags
4027 /// and broadcast the packet to clients 4027 /// and broadcast the packet to clients
@@ -4054,18 +4054,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4054 uint priority = m_prioritizer.GetUpdatePriority(this, entity); 4054 uint priority = m_prioritizer.GetUpdatePriority(this, entity);
4055 4055
4056 lock (m_entityUpdates.SyncRoot) 4056 lock (m_entityUpdates.SyncRoot)
4057 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags)); 4057 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags));
4058 } 4058 }
4059 4059
4060 /// <summary> 4060 /// <summary>
4061 /// Requeue an EntityUpdate when it was not acknowledged by the client. 4061 /// Requeue an EntityUpdate when it was not acknowledged by the client.
4062 /// We will update the priority and put it in the correct queue, merging update flags 4062 /// We will update the priority and put it in the correct queue, merging update flags
4063 /// with any other updates that may be queued for the same entity. 4063 /// with any other updates that may be queued for the same entity.
4064 /// The original update time is used for the merged update. 4064 /// The original update time is used for the merged update.
4065 /// </summary> 4065 /// </summary>
4066 private void ResendPrimUpdate(EntityUpdate update) 4066 private void ResendPrimUpdate(EntityUpdate update)
4067 { 4067 {
4068 // If the update exists in priority queue, it will be updated. 4068 // If the update exists in priority queue, it will be updated.
4069 // If it does not exist then it will be added with the current (rather than its original) priority 4069 // If it does not exist then it will be added with the current (rather than its original) priority
4070 uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); 4070 uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity);
4071 4071
@@ -4074,9 +4074,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4074 } 4074 }
4075 4075
4076 /// <summary> 4076 /// <summary>
4077 /// Requeue a list of EntityUpdates when they were not acknowledged by the client. 4077 /// Requeue a list of EntityUpdates when they were not acknowledged by the client.
4078 /// We will update the priority and put it in the correct queue, merging update flags 4078 /// We will update the priority and put it in the correct queue, merging update flags
4079 /// with any other updates that may be queued for the same entity. 4079 /// with any other updates that may be queued for the same entity.
4080 /// The original update time is used for the merged update. 4080 /// The original update time is used for the merged update.
4081 /// </summary> 4081 /// </summary>
4082 private void ResendPrimUpdates(List<EntityUpdate> updates, OutgoingPacket oPacket) 4082 private void ResendPrimUpdates(List<EntityUpdate> updates, OutgoingPacket oPacket)
@@ -4140,7 +4140,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4140 lock (m_entityUpdates.SyncRoot) 4140 lock (m_entityUpdates.SyncRoot)
4141 if (!m_entityUpdates.TryDequeue(out update, out timeinqueue)) 4141 if (!m_entityUpdates.TryDequeue(out update, out timeinqueue))
4142 break; 4142 break;
4143 4143
4144 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; 4144 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
4145 4145
4146 if(updateFlags.HasFlag(PrimUpdateFlags.Kill)) 4146 if(updateFlags.HasFlag(PrimUpdateFlags.Kill))
@@ -4243,7 +4243,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4243 dpos = (float)Math.Sqrt(dpos) - bradius; 4243 dpos = (float)Math.Sqrt(dpos) - bradius;
4244 if(dpos > cullingrange) 4244 if(dpos > cullingrange)
4245 continue; 4245 continue;
4246 4246
4247 GroupsNeedFullUpdate.Add(grp); 4247 GroupsNeedFullUpdate.Add(grp);
4248 continue; 4248 continue;
4249 } 4249 }
@@ -4276,7 +4276,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4276 bool canUseCompressed = true; 4276 bool canUseCompressed = true;
4277 bool canUseImproved = true; 4277 bool canUseImproved = true;
4278 4278
4279 4279
4280 // Compressed object updates only make sense for LL primitives 4280 // Compressed object updates only make sense for LL primitives
4281 if (!(update.Entity is SceneObjectPart)) 4281 if (!(update.Entity is SceneObjectPart))
4282 { 4282 {
@@ -4316,14 +4316,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4316 canUseImproved = false; 4316 canUseImproved = false;
4317 } 4317 }
4318 } 4318 }
4319 4319
4320 #endregion UpdateFlags to packet type conversion 4320 #endregion UpdateFlags to packet type conversion
4321 4321
4322 #region Block Construction 4322 #region Block Construction
4323 4323
4324 // TODO: Remove this once we can build compressed updates 4324 // TODO: Remove this once we can build compressed updates
4325 canUseCompressed = false; 4325 canUseCompressed = false;
4326 4326
4327 if (!canUseImproved && !canUseCompressed) 4327 if (!canUseImproved && !canUseCompressed)
4328 { 4328 {
4329 ObjectUpdatePacket.ObjectDataBlock ablock; 4329 ObjectUpdatePacket.ObjectDataBlock ablock;
@@ -4368,7 +4368,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4368 } 4368 }
4369 4369
4370 #region Packet Sending 4370 #region Packet Sending
4371 4371
4372 ushort timeDilation; 4372 ushort timeDilation;
4373 4373
4374 if(!IsActive) 4374 if(!IsActive)
@@ -4398,7 +4398,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4398 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4398 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4399 packet.RegionData.TimeDilation = timeDilation; 4399 packet.RegionData.TimeDilation = timeDilation;
4400 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[objectUpdateBlocks.Count]; 4400 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[objectUpdateBlocks.Count];
4401 4401
4402 for (int i = 0; i < objectUpdateBlocks.Count; i++) 4402 for (int i = 0; i < objectUpdateBlocks.Count; i++)
4403 packet.ObjectData[i] = objectUpdateBlocks[i]; 4403 packet.ObjectData[i] = objectUpdateBlocks[i];
4404 4404
@@ -4406,7 +4406,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4406 4406
4407 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); }); 4407 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); });
4408 } 4408 }
4409 4409
4410 if (compressedUpdateBlocks.Count > 0) 4410 if (compressedUpdateBlocks.Count > 0)
4411 { 4411 {
4412 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); 4412 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
@@ -4421,7 +4421,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4421 4421
4422 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); }); 4422 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); });
4423 } 4423 }
4424 4424
4425 if (terseUpdateBlocks.Count > 0) 4425 if (terseUpdateBlocks.Count > 0)
4426 { 4426 {
4427 ImprovedTerseObjectUpdatePacket packet 4427 ImprovedTerseObjectUpdatePacket packet
@@ -4430,7 +4430,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4430 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4430 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4431 packet.RegionData.TimeDilation = timeDilation; 4431 packet.RegionData.TimeDilation = timeDilation;
4432 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[terseUpdateBlocks.Count]; 4432 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[terseUpdateBlocks.Count];
4433 4433
4434 for (int i = 0; i < terseUpdateBlocks.Count; i++) 4434 for (int i = 0; i < terseUpdateBlocks.Count; i++)
4435 packet.ObjectData[i] = terseUpdateBlocks[i]; 4435 packet.ObjectData[i] = terseUpdateBlocks[i];
4436 4436
@@ -4484,11 +4484,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4484 } 4484 }
4485 4485
4486// m_log.DebugFormat( 4486// m_log.DebugFormat(
4487// "[LLCLIENTVIEW]: Sent {0} updates in ProcessEntityUpdates() for {1} {2} in {3}", 4487// "[LLCLIENTVIEW]: Sent {0} updates in ProcessEntityUpdates() for {1} {2} in {3}",
4488// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name); 4488// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
4489// 4489//
4490 } 4490 }
4491 4491
4492 public void ReprioritizeUpdates() 4492 public void ReprioritizeUpdates()
4493 { 4493 {
4494 lock (m_entityUpdates.SyncRoot) 4494 lock (m_entityUpdates.SyncRoot)
@@ -4600,7 +4600,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4600 foreach(SceneObjectPart p in grp.Parts) 4600 foreach(SceneObjectPart p in grp.Parts)
4601 SendEntityUpdate(p,PrimUpdateFlags.CancelKill); 4601 SendEntityUpdate(p,PrimUpdateFlags.CancelKill);
4602 } 4602 }
4603 } 4603 }
4604 4604
4605 CheckGroupsInViewBusy = false; 4605 CheckGroupsInViewBusy = false;
4606 } 4606 }
@@ -4640,8 +4640,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4640 4640
4641 if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) 4641 if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
4642 { 4642 {
4643 int maxUpdateBytes = m_udpClient.GetCatBytesCanSend(ThrottleOutPacketType.Task, 30); 4643 int maxUpdateBytes = m_udpClient.GetCatBytesCanSend(ThrottleOutPacketType.Task, 30);
4644 4644
4645 if (m_entityUpdates.Count > 0) 4645 if (m_entityUpdates.Count > 0)
4646 ProcessEntityUpdates(maxUpdateBytes); 4646 ProcessEntityUpdates(maxUpdateBytes);
4647 4647
@@ -4660,7 +4660,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4660 if (m_entityUpdates.Count > 0) 4660 if (m_entityUpdates.Count > 0)
4661 return true; 4661 return true;
4662 if (m_entityProps.Count > 0) 4662 if (m_entityProps.Count > 0)
4663 return true; 4663 return true;
4664 } 4664 }
4665 4665
4666 if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0) 4666 if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0)
@@ -4775,7 +4775,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4775 { 4775 {
4776 internal bool SendFamilyProps; 4776 internal bool SendFamilyProps;
4777 internal bool SendObjectProps; 4777 internal bool SendObjectProps;
4778 4778
4779 public ObjectPropertyUpdate(ISceneEntity entity, uint flags, bool sendfam, bool sendobj) 4779 public ObjectPropertyUpdate(ISceneEntity entity, uint flags, bool sendfam, bool sendobj)
4780 : base(entity,(PrimUpdateFlags)flags) 4780 : base(entity,(PrimUpdateFlags)flags)
4781 { 4781 {
@@ -4790,7 +4790,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4790 base.Update(update); 4790 base.Update(update);
4791 } 4791 }
4792 } 4792 }
4793 4793
4794 public void SendObjectPropertiesFamilyData(ISceneEntity entity, uint requestFlags) 4794 public void SendObjectPropertiesFamilyData(ISceneEntity entity, uint requestFlags)
4795 { 4795 {
4796 uint priority = 0; // time based ordering only 4796 uint priority = 0; // time based ordering only
@@ -4824,7 +4824,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4824 foreach (ObjectPropertyUpdate update in updates) 4824 foreach (ObjectPropertyUpdate update in updates)
4825 ResendPropertyUpdate(update); 4825 ResendPropertyUpdate(update);
4826 } 4826 }
4827 4827
4828 public void SendObjectPropertiesReply(ISceneEntity entity) 4828 public void SendObjectPropertiesReply(ISceneEntity entity)
4829 { 4829 {
4830 uint priority = 0; // time based ordering only 4830 uint priority = 0; // time based ordering only
@@ -4845,8 +4845,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4845 4845
4846// OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates = 4846// OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates =
4847// new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>(); 4847// new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>();
4848 4848
4849 4849
4850 EntityUpdate iupdate; 4850 EntityUpdate iupdate;
4851 Int32 timeinqueue; // this is just debugging code & can be dropped later 4851 Int32 timeinqueue; // this is just debugging code & can be dropped later
4852 4852
@@ -4882,7 +4882,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4882 } 4882 }
4883 } 4883 }
4884 } 4884 }
4885 4885
4886 if (objectPropertiesBlocks.Count > 0) 4886 if (objectPropertiesBlocks.Count > 0)
4887 { 4887 {
4888 ObjectPropertiesPacket packet = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); 4888 ObjectPropertiesPacket packet = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
@@ -4890,7 +4890,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4890 for (int i = 0; i < objectPropertiesBlocks.Count; i++) 4890 for (int i = 0; i < objectPropertiesBlocks.Count; i++)
4891 packet.ObjectData[i] = objectPropertiesBlocks[i]; 4891 packet.ObjectData[i] = objectPropertiesBlocks[i];
4892 4892
4893 4893
4894 objectPropertiesBlocks.Clear(); 4894 objectPropertiesBlocks.Clear();
4895 packet.Header.Zerocoded = true; 4895 packet.Header.Zerocoded = true;
4896 4896
@@ -4907,12 +4907,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4907 // pbcnt += blocks.Count; 4907 // pbcnt += blocks.Count;
4908 // ppcnt++; 4908 // ppcnt++;
4909 } 4909 }
4910 4910
4911 // Int32 fpcnt = 0; 4911 // Int32 fpcnt = 0;
4912 // Int32 fbcnt = 0; 4912 // Int32 fbcnt = 0;
4913 4913
4914 if (objectFamilyBlocks.Count > 0) 4914 if (objectFamilyBlocks.Count > 0)
4915 { 4915 {
4916 // one packet per object block... uggh... 4916 // one packet per object block... uggh...
4917 for (int i = 0; i < objectFamilyBlocks.Count; i++) 4917 for (int i = 0; i < objectFamilyBlocks.Count; i++)
4918 { 4918 {
@@ -4965,7 +4965,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4965 } 4965 }
4966 needPhysics.Clear(); 4966 needPhysics.Clear();
4967 } 4967 }
4968 4968
4969 // m_log.WarnFormat("[PACKETCOUNTS] queued {0} property packets with {1} blocks",ppcnt,pbcnt); 4969 // m_log.WarnFormat("[PACKETCOUNTS] queued {0} property packets with {1} blocks",ppcnt,pbcnt);
4970 // m_log.WarnFormat("[PACKETCOUNTS] queued {0} family property packets with {1} blocks",fpcnt,fbcnt); 4970 // m_log.WarnFormat("[PACKETCOUNTS] queued {0} family property packets with {1} blocks",fpcnt,fbcnt);
4971 } 4971 }
@@ -4998,7 +4998,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4998 4998
4999 return block; 4999 return block;
5000 } 5000 }
5001 5001
5002 private ObjectPropertiesPacket.ObjectDataBlock CreateObjectPropertiesBlock(SceneObjectPart sop) 5002 private ObjectPropertiesPacket.ObjectDataBlock CreateObjectPropertiesBlock(SceneObjectPart sop)
5003 { 5003 {
5004 //ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); 5004 //ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
@@ -5024,7 +5024,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5024 block.FolderID = UUID.Zero; // sog.FromFolderID ?? 5024 block.FolderID = UUID.Zero; // sog.FromFolderID ??
5025 block.FromTaskID = UUID.Zero; // ??? 5025 block.FromTaskID = UUID.Zero; // ???
5026 block.InventorySerial = (short)sop.InventorySerial; 5026 block.InventorySerial = (short)sop.InventorySerial;
5027 5027
5028 SceneObjectPart root = sop.ParentGroup.RootPart; 5028 SceneObjectPart root = sop.ParentGroup.RootPart;
5029 5029
5030 block.TouchName = Util.StringToBytes256(root.TouchName); 5030 block.TouchName = Util.StringToBytes256(root.TouchName);
@@ -5036,7 +5036,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5036// { 5036// {
5037// using (BinaryWriter binWriter = new BinaryWriter(memStream)) 5037// using (BinaryWriter binWriter = new BinaryWriter(memStream))
5038// { 5038// {
5039// for (int i = 0; i < sop.GetNumberOfSides(); i++) 5039// for (int i = 0; i < sop.GetNumberOfSides(); i++)
5040// { 5040// {
5041// Primitive.TextureEntryFace teFace = sop.Shape.Textures.FaceTextures[i]; 5041// Primitive.TextureEntryFace teFace = sop.Shape.Textures.FaceTextures[i];
5042// 5042//
@@ -5053,7 +5053,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5053// block.TextureID = memStream.ToArray(); 5053// block.TextureID = memStream.ToArray();
5054// } 5054// }
5055// } 5055// }
5056 5056
5057 block.TextureID = new byte[0]; // TextureID ??? 5057 block.TextureID = new byte[0]; // TextureID ???
5058 block.SitName = Util.StringToBytes256(root.SitName); 5058 block.SitName = Util.StringToBytes256(root.SitName);
5059 block.OwnerMask = root.OwnerMask; 5059 block.OwnerMask = root.OwnerMask;
@@ -5202,7 +5202,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5202 public void SendEstateCovenantInformation(UUID covenant) 5202 public void SendEstateCovenantInformation(UUID covenant)
5203 { 5203 {
5204// m_log.DebugFormat("[LLCLIENTVIEW]: Sending estate covenant asset id of {0} to {1}", covenant, Name); 5204// m_log.DebugFormat("[LLCLIENTVIEW]: Sending estate covenant asset id of {0} to {1}", covenant, Name);
5205 5205
5206 EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket(); 5206 EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket();
5207 EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock(); 5207 EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock();
5208 edata.CovenantID = covenant; 5208 edata.CovenantID = covenant;
@@ -5219,7 +5219,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5219 { 5219 {
5220// m_log.DebugFormat( 5220// m_log.DebugFormat(
5221// "[LLCLIENTVIEW]: Sending detailed estate data to {0} with covenant asset id {1}", Name, covenant); 5221// "[LLCLIENTVIEW]: Sending detailed estate data to {0} with covenant asset id {1}", Name, covenant);
5222 5222
5223 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); 5223 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
5224 packet.MethodData.Invoice = invoice; 5224 packet.MethodData.Invoice = invoice;
5225 packet.AgentData.TransactionID = UUID.Random(); 5225 packet.AgentData.TransactionID = UUID.Random();
@@ -5282,13 +5282,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5282 } 5282 }
5283 5283
5284 public void SendLandProperties( 5284 public void SendLandProperties(
5285 int sequence_id, bool snap_selection, int request_result, ILandObject lo, 5285 int sequence_id, bool snap_selection, int request_result, ILandObject lo,
5286 float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) 5286 float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
5287 { 5287 {
5288// m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); 5288// m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name);
5289 5289
5290 LandData landData = lo.LandData; 5290 LandData landData = lo.LandData;
5291 5291
5292 ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); 5292 ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
5293 5293
5294 updateMessage.AABBMax = landData.AABBMax; 5294 updateMessage.AABBMax = landData.AABBMax;
@@ -5301,7 +5301,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5301 updateMessage.Category = landData.Category; 5301 updateMessage.Category = landData.Category;
5302 updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate); 5302 updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate);
5303 updateMessage.ClaimPrice = landData.ClaimPrice; 5303 updateMessage.ClaimPrice = landData.ClaimPrice;
5304 updateMessage.GroupID = landData.GroupID; 5304 updateMessage.GroupID = landData.GroupID;
5305 updateMessage.IsGroupOwned = landData.IsGroupOwned; 5305 updateMessage.IsGroupOwned = landData.IsGroupOwned;
5306 updateMessage.LandingType = (LandingType) landData.LandingType; 5306 updateMessage.LandingType = (LandingType) landData.LandingType;
5307 updateMessage.LocalID = landData.LocalID; 5307 updateMessage.LocalID = landData.LocalID;
@@ -5322,7 +5322,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5322 updateMessage.Name = landData.Name; 5322 updateMessage.Name = landData.Name;
5323 updateMessage.OtherCleanTime = landData.OtherCleanTime; 5323 updateMessage.OtherCleanTime = landData.OtherCleanTime;
5324 updateMessage.OtherCount = 0; //TODO: Unimplemented 5324 updateMessage.OtherCount = 0; //TODO: Unimplemented
5325 updateMessage.OwnerID = landData.OwnerID; 5325 updateMessage.OwnerID = landData.OwnerID;
5326 updateMessage.ParcelFlags = (ParcelFlags) landData.Flags; 5326 updateMessage.ParcelFlags = (ParcelFlags) landData.Flags;
5327 updateMessage.ParcelPrimBonus = simObjectBonusFactor; 5327 updateMessage.ParcelPrimBonus = simObjectBonusFactor;
5328 updateMessage.PassHours = landData.PassHours; 5328 updateMessage.PassHours = landData.PassHours;
@@ -5337,10 +5337,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5337 5337
5338 updateMessage.RentPrice = 0; 5338 updateMessage.RentPrice = 0;
5339 updateMessage.RequestResult = (ParcelResult) request_result; 5339 updateMessage.RequestResult = (ParcelResult) request_result;
5340 updateMessage.SalePrice = landData.SalePrice; 5340 updateMessage.SalePrice = landData.SalePrice;
5341 updateMessage.SelfCount = 0; //TODO: Unimplemented 5341 updateMessage.SelfCount = 0; //TODO: Unimplemented
5342 updateMessage.SequenceID = sequence_id; 5342 updateMessage.SequenceID = sequence_id;
5343 5343
5344 if (landData.SimwideArea > 0) 5344 if (landData.SimwideArea > 0)
5345 { 5345 {
5346 updateMessage.SimWideMaxPrims = lo.GetSimulatorMaxPrimCount(); 5346 updateMessage.SimWideMaxPrims = lo.GetSimulatorMaxPrimCount();
@@ -5349,7 +5349,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5349 { 5349 {
5350 updateMessage.SimWideMaxPrims = 0; 5350 updateMessage.SimWideMaxPrims = 0;
5351 } 5351 }
5352 5352
5353 updateMessage.SnapSelection = snap_selection; 5353 updateMessage.SnapSelection = snap_selection;
5354 updateMessage.SnapshotID = landData.SnapshotID; 5354 updateMessage.SnapshotID = landData.SnapshotID;
5355 updateMessage.Status = (ParcelStatus) landData.Status; 5355 updateMessage.Status = (ParcelStatus) landData.Status;
@@ -5367,11 +5367,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5367 updateMessage.SeeAVs = landData.SeeAVs; 5367 updateMessage.SeeAVs = landData.SeeAVs;
5368 updateMessage.AnyAVSounds = landData.AnyAVSounds; 5368 updateMessage.AnyAVSounds = landData.AnyAVSounds;
5369 updateMessage.GroupAVSounds = landData.GroupAVSounds; 5369 updateMessage.GroupAVSounds = landData.GroupAVSounds;
5370 5370
5371 IPrimCounts pc = lo.PrimCounts; 5371 IPrimCounts pc = lo.PrimCounts;
5372 updateMessage.OwnerPrims = pc.Owner; 5372 updateMessage.OwnerPrims = pc.Owner;
5373 updateMessage.GroupPrims = pc.Group; 5373 updateMessage.GroupPrims = pc.Group;
5374 updateMessage.OtherPrims = pc.Others; 5374 updateMessage.OtherPrims = pc.Others;
5375 updateMessage.SelectedPrims = pc.Selected; 5375 updateMessage.SelectedPrims = pc.Selected;
5376 updateMessage.TotalPrims = pc.Total; 5376 updateMessage.TotalPrims = pc.Total;
5377 updateMessage.SimWideTotalPrims = pc.Simulator; 5377 updateMessage.SimWideTotalPrims = pc.Simulator;
@@ -5384,8 +5384,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5384 if (eq != null) 5384 if (eq != null)
5385 { 5385 {
5386 eq.ParcelProperties(updateMessage, this.AgentId); 5386 eq.ParcelProperties(updateMessage, this.AgentId);
5387 } 5387 }
5388 else 5388 else
5389 { 5389 {
5390 m_log.Warn("[LLCLIENTVIEW]: No EQ Interface when sending parcel data."); 5390 m_log.Warn("[LLCLIENTVIEW]: No EQ Interface when sending parcel data.");
5391 } 5391 }
@@ -5422,7 +5422,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5422 public void SendForceClientSelectObjects(List<uint> ObjectIDs) 5422 public void SendForceClientSelectObjects(List<uint> ObjectIDs)
5423 { 5423 {
5424// m_log.DebugFormat("[LLCLIENTVIEW] sending select with {0} objects", ObjectIDs.Count); 5424// m_log.DebugFormat("[LLCLIENTVIEW] sending select with {0} objects", ObjectIDs.Count);
5425 5425
5426 bool firstCall = true; 5426 bool firstCall = true;
5427 const int MAX_OBJECTS_PER_PACKET = 251; 5427 const int MAX_OBJECTS_PER_PACKET = 251;
5428 ForceObjectSelectPacket pack = (ForceObjectSelectPacket)PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect); 5428 ForceObjectSelectPacket pack = (ForceObjectSelectPacket)PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect);
@@ -5634,7 +5634,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5634 5634
5635 ImprovedTerseObjectUpdatePacket.ObjectDataBlock block 5635 ImprovedTerseObjectUpdatePacket.ObjectDataBlock block
5636 = PacketPool.Instance.GetDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); 5636 = PacketPool.Instance.GetDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
5637 5637
5638 block.Data = data; 5638 block.Data = data;
5639 5639
5640 if (textureEntry != null && textureEntry.Length > 0) 5640 if (textureEntry != null && textureEntry.Length > 0)
@@ -5661,7 +5661,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5661 Vector3 offsetPosition = data.OffsetPosition; 5661 Vector3 offsetPosition = data.OffsetPosition;
5662 Quaternion rotation = data.Rotation; 5662 Quaternion rotation = data.Rotation;
5663 uint parentID = data.ParentID; 5663 uint parentID = data.ParentID;
5664 5664
5665// m_log.DebugFormat( 5665// m_log.DebugFormat(
5666// "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name); 5666// "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name);
5667 5667
@@ -5752,7 +5752,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5752/* 5752/*
5753 if (data.ParentGroup.IsAttachment) 5753 if (data.ParentGroup.IsAttachment)
5754 { 5754 {
5755 update.NameValue 5755 update.NameValue
5756 = Util.StringToBytes256( 5756 = Util.StringToBytes256(
5757 string.Format("AttachItemID STRING RW SV {0}", data.ParentGroup.FromItemID)); 5757 string.Format("AttachItemID STRING RW SV {0}", data.ParentGroup.FromItemID));
5758 5758
@@ -5906,7 +5906,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5906 { 5906 {
5907 m_groupPowers.Clear(); 5907 m_groupPowers.Clear();
5908 m_groupPowers = powers; 5908 m_groupPowers = powers;
5909 } 5909 }
5910 } 5910 }
5911 5911
5912 public ulong GetGroupPowers(UUID groupID) 5912 public ulong GetGroupPowers(UUID groupID)
@@ -6193,7 +6193,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6193 { 6193 {
6194 if( 6194 if(
6195 (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed 6195 (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed
6196// || ((x.ControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0 && 6196// || ((x.ControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0 &&
6197// (x.ControlFlags & 0x3f8dfff) != 0) // we need to rotate the av on fly 6197// (x.ControlFlags & 0x3f8dfff) != 0) // we need to rotate the av on fly
6198 || x.ControlFlags != (byte)AgentManager.ControlFlags.NONE// actually all movement controls need to pass 6198 || x.ControlFlags != (byte)AgentManager.ControlFlags.NONE// actually all movement controls need to pass
6199 || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed 6199 || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed
@@ -6208,7 +6208,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6208 if( 6208 if(
6209 qdelta1 < QDELTABody // significant if body rotation above(below cos) threshold 6209 qdelta1 < QDELTABody // significant if body rotation above(below cos) threshold
6210 // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack 6210 // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack
6211 // || qdelta2 < QDELTAHead // significant if head rotation above(below cos) threshold 6211 // || qdelta2 < QDELTAHead // significant if head rotation above(below cos) threshold
6212 ) 6212 )
6213 return true; 6213 return true;
6214 6214
@@ -6257,7 +6257,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6257 6257
6258 TotalAgentUpdates++; 6258 TotalAgentUpdates++;
6259 // dont let ignored updates pollute this throttles 6259 // dont let ignored updates pollute this throttles
6260 if(SceneAgent == null || SceneAgent.IsChildAgent || 6260 if(SceneAgent == null || SceneAgent.IsChildAgent ||
6261 SceneAgent.IsInTransit || seq <= m_thisAgentUpdateArgs.lastpacketSequence ) 6261 SceneAgent.IsInTransit || seq <= m_thisAgentUpdateArgs.lastpacketSequence )
6262 { 6262 {
6263 // throttle reset is done at MoveAgentIntoRegion() 6263 // throttle reset is done at MoveAgentIntoRegion()
@@ -6476,7 +6476,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6476 } 6476 }
6477 } 6477 }
6478 } 6478 }
6479 6479
6480 //m_log.Debug("[LLCLIENTVIEW]: Not handling GenericMessage with method-type of: " + method); 6480 //m_log.Debug("[LLCLIENTVIEW]: Not handling GenericMessage with method-type of: " + method);
6481 return false; 6481 return false;
6482 } 6482 }
@@ -6922,7 +6922,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6922 //m_log.Info("[LAND]: LAND:" + modify.ToString()); 6922 //m_log.Info("[LAND]: LAND:" + modify.ToString());
6923 if (modify.ParcelData.Length > 0) 6923 if (modify.ParcelData.Length > 0)
6924 { 6924 {
6925 // Note: the ModifyTerrain event handler sends out updated packets before the end of this event. Therefore, 6925 // Note: the ModifyTerrain event handler sends out updated packets before the end of this event. Therefore,
6926 // a simple boolean value should work and perhaps queue up just a few terrain patch packets at the end of the edit. 6926 // a simple boolean value should work and perhaps queue up just a few terrain patch packets at the end of the edit.
6927 if (OnModifyTerrain != null) 6927 if (OnModifyTerrain != null)
6928 { 6928 {
@@ -6999,20 +6999,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6999 byte[] visualparams = new byte[appear.VisualParam.Length]; 6999 byte[] visualparams = new byte[appear.VisualParam.Length];
7000 for (int i = 0; i < appear.VisualParam.Length; i++) 7000 for (int i = 0; i < appear.VisualParam.Length; i++)
7001 visualparams[i] = appear.VisualParam[i].ParamValue; 7001 visualparams[i] = appear.VisualParam[i].ParamValue;
7002 //var b = appear.WearableData[0]; 7002 //var b = appear.WearableData[0];
7003 7003
7004 Primitive.TextureEntry te = null; 7004 Primitive.TextureEntry te = null;
7005 if (appear.ObjectData.TextureEntry.Length > 1) 7005 if (appear.ObjectData.TextureEntry.Length > 1)
7006 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); 7006 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
7007 7007
7008 WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; 7008 WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length];
7009 for (int i=0; i<appear.WearableData.Length;i++) 7009 for (int i=0; i<appear.WearableData.Length;i++)
7010 cacheitems[i] = new WearableCacheItem(){ 7010 cacheitems[i] = new WearableCacheItem(){
7011 CacheId = appear.WearableData[i].CacheID, 7011 CacheId = appear.WearableData[i].CacheID,
7012 TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex) 7012 TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)
7013 }; 7013 };
7014 7014
7015 7015
7016 7016
7017 handlerSetAppearance(sender, te, visualparams,avSize, cacheitems); 7017 handlerSetAppearance(sender, te, visualparams,avSize, cacheitems);
7018 } 7018 }
@@ -7970,7 +7970,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7970 physdata.Bounce = phsblock.Restitution; 7970 physdata.Bounce = phsblock.Restitution;
7971 physdata.Density = phsblock.Density; 7971 physdata.Density = phsblock.Density;
7972 physdata.Friction = phsblock.Friction; 7972 physdata.Friction = phsblock.Friction;
7973 physdata.GravitationModifier = phsblock.GravityMultiplier; 7973 physdata.GravitationModifier = phsblock.GravityMultiplier;
7974 } 7974 }
7975 7975
7976 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); 7976 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this);
@@ -8381,7 +8381,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8381 handlerObjectDuplicateOnRay = OnObjectDuplicateOnRay; 8381 handlerObjectDuplicateOnRay = OnObjectDuplicateOnRay;
8382 if (handlerObjectDuplicateOnRay != null) 8382 if (handlerObjectDuplicateOnRay != null)
8383 { 8383 {
8384 8384
8385 UUID rezGroupID = dupeOnRay.AgentData.GroupID; 8385 UUID rezGroupID = dupeOnRay.AgentData.GroupID;
8386 if(!IsGroupMember(rezGroupID)) 8386 if(!IsGroupMember(rezGroupID))
8387 rezGroupID = UUID.Zero; 8387 rezGroupID = UUID.Zero;
@@ -10198,7 +10198,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10198 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) 10198 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
10199 { 10199 {
10200 int estateAccessType = Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); 10200 int estateAccessType = Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
10201 10201
10202 OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice, estateAccessType, new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter))); 10202 OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice, estateAccessType, new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)));
10203 10203
10204 } 10204 }
@@ -10234,7 +10234,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10234 Message = Utils.BytesToString(messagePacket.ParamList[1].Parameter); 10234 Message = Utils.BytesToString(messagePacket.ParamList[1].Parameter);
10235 } 10235 }
10236 else 10236 else
10237 { 10237 {
10238 SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)); 10238 SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
10239 SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter); 10239 SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter);
10240 Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter); 10240 Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter);
@@ -10376,7 +10376,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10376 return true; 10376 return true;
10377 10377
10378 case "kickestate": 10378 case "kickestate":
10379 10379
10380 if(((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) 10380 if(((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
10381 { 10381 {
10382 UUID invoice = messagePacket.MethodData.Invoice; 10382 UUID invoice = messagePacket.MethodData.Invoice;
@@ -10459,7 +10459,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10459 if (rglpPack.AgentData.SessionID != SessionId || 10459 if (rglpPack.AgentData.SessionID != SessionId ||
10460 rglpPack.AgentData.AgentID != AgentId) 10460 rglpPack.AgentData.AgentID != AgentId)
10461 return true; 10461 return true;
10462 10462
10463 RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock; 10463 RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock;
10464 UUID token = rblock.Token; 10464 UUID token = rblock.Token;
10465 10465
@@ -10975,7 +10975,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10975 { 10975 {
10976 return true; 10976 return true;
10977 } 10977 }
10978 10978
10979 private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack) 10979 private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack)
10980 { 10980 {
10981 CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack; 10981 CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack;
@@ -11012,7 +11012,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11012 return true; 11012 return true;
11013 } 11013 }
11014 11014
11015 11015
11016 private bool HandleInventoryDescendents(IClientAPI sender, Packet Pack) 11016 private bool HandleInventoryDescendents(IClientAPI sender, Packet Pack)
11017 { 11017 {
11018 return true; 11018 return true;
@@ -11402,7 +11402,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11402 GroupProfileRequestPacket groupProfileRequest = 11402 GroupProfileRequestPacket groupProfileRequest =
11403 (GroupProfileRequestPacket)Pack; 11403 (GroupProfileRequestPacket)Pack;
11404 11404
11405 11405
11406 #region Packet Session and User Check 11406 #region Packet Session and User Check
11407 if (m_checkPackets) 11407 if (m_checkPackets)
11408 { 11408 {
@@ -11464,7 +11464,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11464 } 11464 }
11465 11465
11466 OutPacket(groupProfileReply, ThrottleOutPacketType.Task); 11466 OutPacket(groupProfileReply, ThrottleOutPacketType.Task);
11467 11467
11468 if(grpID == lastGroupProfileRequestID) 11468 if(grpID == lastGroupProfileRequestID)
11469 lastGroupProfileRequestTS = Util.GetTimeStampMS() - 7000; 11469 lastGroupProfileRequestTS = Util.GetTimeStampMS() - 7000;
11470 11470
@@ -12398,10 +12398,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12398 ScenePresence sp = (ScenePresence)SceneAgent; 12398 ScenePresence sp = (ScenePresence)SceneAgent;
12399 if(sp != null && !sp.IsDeleted && !sp.IsInTransit) 12399 if(sp != null && !sp.IsDeleted && !sp.IsInTransit)
12400 { 12400 {
12401 UUID objectID = pkt.Data.ObjectID; 12401 UUID objectID = pkt.Data.ObjectID;
12402 uint permissions = pkt.Data.ObjectPermissions; 12402 uint permissions = pkt.Data.ObjectPermissions;
12403 12403
12404 sp.HandleRevokePermissions(objectID , permissions); 12404 sp.HandleRevokePermissions(objectID , permissions);
12405 } 12405 }
12406 return true; 12406 return true;
12407 } 12407 }
@@ -12437,7 +12437,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12437 scriptQuestion.Data.Questions = question; 12437 scriptQuestion.Data.Questions = question;
12438 scriptQuestion.Data.ObjectName = Util.StringToBytes256(taskName); 12438 scriptQuestion.Data.ObjectName = Util.StringToBytes256(taskName);
12439 scriptQuestion.Data.ObjectOwner = Util.StringToBytes256(ownerName); 12439 scriptQuestion.Data.ObjectOwner = Util.StringToBytes256(ownerName);
12440 12440
12441 OutPacket(scriptQuestion, ThrottleOutPacketType.Task); 12441 OutPacket(scriptQuestion, ThrottleOutPacketType.Task);
12442 } 12442 }
12443 12443
@@ -12629,7 +12629,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12629 * 0x01 position 12629 * 0x01 position
12630 * 0x02 rotation 12630 * 0x02 rotation
12631 * 0x04 scale 12631 * 0x04 scale
12632 12632
12633 * 0x08 LINK_SET 12633 * 0x08 LINK_SET
12634 * 0x10 UNIFORM for scale 12634 * 0x10 UNIFORM for scale
12635 */ 12635 */
@@ -12668,7 +12668,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12668 updatehandler(localId, udata, this); 12668 updatehandler(localId, udata, this);
12669 break; 12669 break;
12670 12670
12671 case 0x14: // uniform scale sp 12671 case 0x14: // uniform scale sp
12672 udata.scale = new Vector3(block.Data, 0); 12672 udata.scale = new Vector3(block.Data, 0);
12673 12673
12674 udata.change = ObjectChangeType.primUS; 12674 udata.change = ObjectChangeType.primUS;
@@ -12938,7 +12938,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12938 12938
12939 if (DebugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect)) 12939 if (DebugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect))
12940 logPacket = false; 12940 logPacket = false;
12941 12941
12942 if (DebugPacketLevel <= 50 12942 if (DebugPacketLevel <= 50
12943 && (packet.Type == PacketType.ImprovedTerseObjectUpdate || packet.Type == PacketType.ObjectUpdate)) 12943 && (packet.Type == PacketType.ImprovedTerseObjectUpdate || packet.Type == PacketType.ObjectUpdate))
12944 logPacket = false; 12944 logPacket = false;
@@ -12951,7 +12951,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12951 "[CLIENT]: PACKET OUT to {0} ({1}) in {2} - {3}", 12951 "[CLIENT]: PACKET OUT to {0} ({1}) in {2} - {3}",
12952 Name, SceneAgent.IsChildAgent ? "child" : "root ", m_scene.RegionInfo.RegionName, packet.Type); 12952 Name, SceneAgent.IsChildAgent ? "child" : "root ", m_scene.RegionInfo.RegionName, packet.Type);
12953 } 12953 }
12954 12954
12955 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting, method); 12955 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting, method);
12956 } 12956 }
12957 12957
@@ -13198,9 +13198,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
13198 { 13198 {
13199 GroupMembershipData[] GroupMembership = 13199 GroupMembershipData[] GroupMembership =
13200 m_GroupsModule.GetMembershipData(AgentId); 13200 m_GroupsModule.GetMembershipData(AgentId);
13201 13201
13202 m_groupPowers.Clear(); 13202 m_groupPowers.Clear();
13203 13203
13204 if (GroupMembership != null) 13204 if (GroupMembership != null)
13205 { 13205 {
13206 for (int i = 0; i < GroupMembership.Length; i++) 13206 for (int i = 0; i < GroupMembership.Length; i++)
@@ -13220,7 +13220,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
13220 m_activeGroupName = activeMembership.GroupName; 13220 m_activeGroupName = activeMembership.GroupName;
13221 m_activeGroupPowers = ActiveGroupPowers; 13221 m_activeGroupPowers = ActiveGroupPowers;
13222 } 13222 }
13223 } 13223 }
13224 } 13224 }
13225 13225
13226 if(activeMembership == null) 13226 if(activeMembership == null)
@@ -13237,7 +13237,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
13237 lock(m_groupPowers) 13237 lock(m_groupPowers)
13238 { 13238 {
13239 m_groupPowers.Clear(); 13239 m_groupPowers.Clear();
13240 13240
13241 if (data != null) 13241 if (data != null)
13242 { 13242 {
13243 for (int i = 0; i < data.Length; i++) 13243 for (int i = 0; i < data.Length; i++)
@@ -13522,7 +13522,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
13522 if (p is ScenePresence) 13522 if (p is ScenePresence)
13523 { 13523 {
13524// m_log.DebugFormat( 13524// m_log.DebugFormat(
13525// "[LLCLIENTVIEW]: Immediately sending terse agent update for {0} to {1} in {2}", 13525// "[LLCLIENTVIEW]: Immediately sending terse agent update for {0} to {1} in {2}",
13526// p.Name, Name, Scene.Name); 13526// p.Name, Name, Scene.Name);
13527 13527
13528 // It turns out to get the agent to stop flying, you have to feed it stop flying velocities 13528 // It turns out to get the agent to stop flying, you have to feed it stop flying velocities
@@ -13559,7 +13559,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
13559 PlacesReplyData[] data) 13559 PlacesReplyData[] data)
13560 { 13560 {
13561 PlacesReplyPacket reply = null; 13561 PlacesReplyPacket reply = null;
13562 PlacesReplyPacket.QueryDataBlock[] dataBlocks = 13562 PlacesReplyPacket.QueryDataBlock[] dataBlocks =
13563 new PlacesReplyPacket.QueryDataBlock[0]; 13563 new PlacesReplyPacket.QueryDataBlock[0];
13564 13564
13565 for (int i = 0 ; i < data.Length ; i++) 13565 for (int i = 0 ; i < data.Length ; i++)
@@ -13737,7 +13737,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
13737 foreach (InventoryItemBase item in items) 13737 foreach (InventoryItemBase item in items)
13738 { 13738 {
13739 OSDMap ItemDataMap = new OSDMap(); 13739 OSDMap ItemDataMap = new OSDMap();
13740 13740
13741 ItemDataMap.Add("ItemID", OSD.FromUUID(item.ID)); 13741 ItemDataMap.Add("ItemID", OSD.FromUUID(item.ID));
13742 ItemDataMap.Add("FolderID", OSD.FromUUID(item.Folder)); 13742 ItemDataMap.Add("FolderID", OSD.FromUUID(item.Folder));
13743 13743
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
index 41dd4d1..deefd40 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
@@ -82,7 +82,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
82 82
83 if (pAssetCache != null) 83 if (pAssetCache != null)
84 m_missingImage = pAssetCache.Get("5748decc-f629-461c-9a36-a35a221fe21f"); 84 m_missingImage = pAssetCache.Get("5748decc-f629-461c-9a36-a35a221fe21f");
85 85
86 if (m_missingImage == null) 86 if (m_missingImage == null)
87 m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client"); 87 m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client");
88 88
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index dc8ac3c..439621a 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
52 /// are waiting on ACKs for</param> 52 /// are waiting on ACKs for</param>
53 public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes); 53 public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes);
54 /// <summary> 54 /// <summary>
55 /// Fired when the queue for one or more packet categories is empty. This 55 /// Fired when the queue for one or more packet categories is empty. This
56 /// event can be hooked to put more data on the empty queues 56 /// event can be hooked to put more data on the empty queues
57 /// </summary> 57 /// </summary>
58 /// <param name="category">Categories of the packet queues that are empty</param> 58 /// <param name="category">Categories of the packet queues that are empty</param>
@@ -86,8 +86,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
86 /// Controls whether information is logged about each outbound packet immediately before it is sent. For debug purposes. 86 /// Controls whether information is logged about each outbound packet immediately before it is sent. For debug purposes.
87 /// </summary> 87 /// </summary>
88 /// <remarks>Any level above 0 will turn on logging.</remarks> 88 /// <remarks>Any level above 0 will turn on logging.</remarks>
89 public int ThrottleDebugLevel 89 public int ThrottleDebugLevel
90 { 90 {
91 get 91 get
92 { 92 {
93 return m_throttleDebugLevel; 93 return m_throttleDebugLevel;
@@ -157,7 +157,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
157 /// <summary>Number of packets sent to this client</summary> 157 /// <summary>Number of packets sent to this client</summary>
158 public int PacketsSent; 158 public int PacketsSent;
159 /// <summary>Number of packets resent to this client</summary> 159 /// <summary>Number of packets resent to this client</summary>
160 public int PacketsResent; 160 public int PacketsResent;
161 /// <summary>Total byte count of unacked packets sent to this client</summary> 161 /// <summary>Total byte count of unacked packets sent to this client</summary>
162 public int UnackedBytes; 162 public int UnackedBytes;
163 163
@@ -215,7 +215,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
215 /// textures are now generally handled through http. 215 /// textures are now generally handled through http.
216 /// </summary> 216 /// </summary>
217 private double m_cannibalrate = 0.0; 217 private double m_cannibalrate = 0.0;
218 218
219 private ClientInfo m_info = new ClientInfo(); 219 private ClientInfo m_info = new ClientInfo();
220 220
221 /// <summary> 221 /// <summary>
@@ -276,7 +276,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
276 276
277 // Initialize this to a sane value to prevent early disconnects 277 // Initialize this to a sane value to prevent early disconnects
278 TickLastPacketReceived = Environment.TickCount & Int32.MaxValue; 278 TickLastPacketReceived = Environment.TickCount & Int32.MaxValue;
279 m_pingMS = (int)(3.0 * server.TickCountResolution); // so filter doesnt start at 0; 279 m_pingMS = (int)(3.0 * server.TickCountResolution); // so filter doesnt start at 0;
280 } 280 }
281 281
282 /// <summary> 282 /// <summary>
@@ -370,7 +370,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
370 return string.Format( 370 return string.Format(
371 "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}", 371 "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}",
372 Util.EnvironmentTickCountSubtract(TickLastPacketReceived), 372 Util.EnvironmentTickCountSubtract(TickLastPacketReceived),
373 PacketsReceived, 373 PacketsReceived,
374 PacketsSent, 374 PacketsSent,
375 PacketsResent, 375 PacketsResent,
376 UnackedBytes, 376 UnackedBytes,
@@ -540,7 +540,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
540 540
541 return data; 541 return data;
542 } 542 }
543 543
544 public int GetCatBytesCanSend(ThrottleOutPacketType cat, int timeMS) 544 public int GetCatBytesCanSend(ThrottleOutPacketType cat, int timeMS)
545 { 545 {
546 int icat = (int)cat; 546 int icat = (int)cat;
@@ -559,7 +559,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
559 /// <param name="packet"></param> 559 /// <param name="packet"></param>
560 /// <param name="forceQueue">Always queue the packet if at all possible.</param> 560 /// <param name="forceQueue">Always queue the packet if at all possible.</param>
561 /// <returns> 561 /// <returns>
562 /// true if the packet has been queued, 562 /// true if the packet has been queued,
563 /// false if the packet has not been queued and should be sent immediately. 563 /// false if the packet has not been queued and should be sent immediately.
564 /// </returns> 564 /// </returns>
565 public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue) 565 public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue)
@@ -589,7 +589,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
589 queue.Enqueue(packet, highPriority); 589 queue.Enqueue(packet, highPriority);
590 return true; 590 return true;
591 } 591 }
592 592
593 if (!forceQueue && bucket.CheckTokens(packet.Buffer.DataLength)) 593 if (!forceQueue && bucket.CheckTokens(packet.Buffer.DataLength))
594 { 594 {
595 // enough tokens so it can be sent imediatly by caller 595 // enough tokens so it can be sent imediatly by caller
@@ -608,24 +608,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
608 // We don't have a token bucket for this category, so it will not be queued 608 // We don't have a token bucket for this category, so it will not be queued
609 return false; 609 return false;
610 } 610 }
611 611
612 } 612 }
613 613
614 /// <summary> 614 /// <summary>
615 /// Loops through all of the packet queues for this client and tries to send 615 /// Loops through all of the packet queues for this client and tries to send
616 /// an outgoing packet from each, obeying the throttling bucket limits 616 /// an outgoing packet from each, obeying the throttling bucket limits
617 /// </summary> 617 /// </summary>
618 /// 618 ///
619 /// <remarks> 619 /// <remarks>
620 /// Packet queues are inspected in ascending numerical order starting from 0. Therefore, queues with a lower 620 /// Packet queues are inspected in ascending numerical order starting from 0. Therefore, queues with a lower
621 /// ThrottleOutPacketType number will see their packet get sent first (e.g. if both Land and Wind queues have 621 /// ThrottleOutPacketType number will see their packet get sent first (e.g. if both Land and Wind queues have
622 /// packets, then the packet at the front of the Land queue will be sent before the packet at the front of the 622 /// packets, then the packet at the front of the Land queue will be sent before the packet at the front of the
623 /// wind queue). 623 /// wind queue).
624 /// 624 ///
625 /// This function is only called from a synchronous loop in the 625 /// This function is only called from a synchronous loop in the
626 /// UDPServer so we don't need to bother making this thread safe 626 /// UDPServer so we don't need to bother making this thread safe
627 /// </remarks> 627 /// </remarks>
628 /// 628 ///
629 /// <returns>True if any packets were sent, otherwise false</returns> 629 /// <returns>True if any packets were sent, otherwise false</returns>
630 public bool DequeueOutgoing() 630 public bool DequeueOutgoing()
631 { 631 {
@@ -791,7 +791,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
791 double start = Util.GetTimeStampMS(); 791 double start = Util.GetTimeStampMS();
792 if (start < m_nextOnQueueEmpty) 792 if (start < m_nextOnQueueEmpty)
793 return; 793 return;
794 794
795 m_isQueueEmptyRunning = true; 795 m_isQueueEmptyRunning = true;
796 m_nextOnQueueEmpty = start + MIN_CALLBACK_MS; 796 m_nextOnQueueEmpty = start + MIN_CALLBACK_MS;
797 797
@@ -803,7 +803,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
803 } 803 }
804 } 804 }
805 805
806 806
807 807
808 /// <summary> 808 /// <summary>
809 /// Fires the OnQueueEmpty callback and sets the minimum time that it 809 /// Fires the OnQueueEmpty callback and sets the minimum time that it
@@ -820,7 +820,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
820 if (callback != null) 820 if (callback != null)
821 { 821 {
822 // if (m_udpServer.IsRunningOutbound) 822 // if (m_udpServer.IsRunningOutbound)
823 // { 823 // {
824 try { callback(categories); } 824 try { callback(categories); }
825 catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + categories + ") threw an exception: " + e.Message, e); } 825 catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + categories + ") threw an exception: " + e.Message, e); }
826 // } 826 // }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index cedb9b4..ec51e28 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -222,7 +222,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
222 StatType.Pull, 222 StatType.Pull,
223 MeasuresOfInterest.None, 223 MeasuresOfInterest.None,
224 stat => stat.Value = m_udpServer.AverageReceiveTicksForLastSamplePeriod, 224 stat => stat.Value = m_udpServer.AverageReceiveTicksForLastSamplePeriod,
225// stat => 225// stat =>
226// stat.Value = Math.Round(m_udpServer.AverageReceiveTicksForLastSamplePeriod, 7), 226// stat.Value = Math.Round(m_udpServer.AverageReceiveTicksForLastSamplePeriod, 7),
227 StatVerbosity.Debug)); 227 StatVerbosity.Debug));
228 } 228 }
@@ -272,7 +272,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
272 /// <summary>The measured resolution of Environment.TickCount</summary> 272 /// <summary>The measured resolution of Environment.TickCount</summary>
273 public readonly float TickCountResolution; 273 public readonly float TickCountResolution;
274 274
275 /// <summary>Number of prim updates to put on the queue each time the 275 /// <summary>Number of prim updates to put on the queue each time the
276 /// OnQueueEmpty event is triggered for updates</summary> 276 /// OnQueueEmpty event is triggered for updates</summary>
277 public readonly int PrimUpdatesPerCallback; 277 public readonly int PrimUpdatesPerCallback;
278 278
@@ -289,7 +289,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
289 289
290 /// <summary>Bandwidth throttle for this UDP server</summary> 290 /// <summary>Bandwidth throttle for this UDP server</summary>
291 public TokenBucket Throttle { get; protected set; } 291 public TokenBucket Throttle { get; protected set; }
292 292
293 /// <summary>Per client throttle rates enforced by this server</summary> 293 /// <summary>Per client throttle rates enforced by this server</summary>
294 /// <remarks> 294 /// <remarks>
295 /// If the total rate is non-zero, then this is the maximum total throttle setting that any client can ever have. 295 /// If the total rate is non-zero, then this is the maximum total throttle setting that any client can ever have.
@@ -297,7 +297,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
297 /// do get changed immediately). They do not need to sum to the total. 297 /// do get changed immediately). They do not need to sum to the total.
298 /// </remarks> 298 /// </remarks>
299 public ThrottleRates ThrottleRates { get; protected set; } 299 public ThrottleRates ThrottleRates { get; protected set; }
300 300
301 /// <summary>Manages authentication for agent circuits</summary> 301 /// <summary>Manages authentication for agent circuits</summary>
302 protected AgentCircuitManager m_circuitManager; 302 protected AgentCircuitManager m_circuitManager;
303 303
@@ -436,8 +436,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
436 { 436 {
437 #region Environment.TickCount Measurement 437 #region Environment.TickCount Measurement
438 438
439 // Update the port with the one we actually got 439 // Update the port with the one we actually got
440 port = (uint)Port; 440 port = (uint)Port;
441 441
442 // Measure the resolution of Environment.TickCount 442 // Measure the resolution of Environment.TickCount
443 TickCountResolution = 0f; 443 TickCountResolution = 0f;
@@ -696,15 +696,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
696 696
697 Scene = (Scene)scene; 697 Scene = (Scene)scene;
698 m_location = new Location(Scene.RegionInfo.RegionHandle); 698 m_location = new Location(Scene.RegionInfo.RegionHandle);
699 699
700 IpahEngine 700 IpahEngine
701 = new JobEngine( 701 = new JobEngine(
702 string.Format("Incoming Packet Async Handling Engine ({0})", Scene.Name), 702 string.Format("Incoming Packet Async Handling Engine ({0})", Scene.Name),
703 "INCOMING PACKET ASYNC HANDLING ENGINE"); 703 "INCOMING PACKET ASYNC HANDLING ENGINE");
704 704
705 OqrEngine 705 OqrEngine
706 = new JobEngine( 706 = new JobEngine(
707 string.Format("Outgoing Queue Refill Engine ({0})", Scene.Name), 707 string.Format("Outgoing Queue Refill Engine ({0})", Scene.Name),
708 "OUTGOING QUEUE REFILL ENGINE"); 708 "OUTGOING QUEUE REFILL ENGINE");
709 709
710 StatsManager.RegisterStat( 710 StatsManager.RegisterStat(
@@ -730,9 +730,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
730 "clientstack", 730 "clientstack",
731 Scene.Name, 731 Scene.Name,
732 StatType.Pull, 732 StatType.Pull,
733 stat => 733 stat =>
734 { PercentageStat pstat = (PercentageStat)stat; 734 { PercentageStat pstat = (PercentageStat)stat;
735 pstat.Consequent = PacketPool.Instance.PacketsRequested; 735 pstat.Consequent = PacketPool.Instance.PacketsRequested;
736 pstat.Antecedent = PacketPool.Instance.PacketsReused; }, 736 pstat.Antecedent = PacketPool.Instance.PacketsReused; },
737 StatVerbosity.Debug)); 737 StatVerbosity.Debug));
738 738
@@ -745,8 +745,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
745 Scene.Name, 745 Scene.Name,
746 StatType.Pull, 746 StatType.Pull,
747 stat => 747 stat =>
748 { PercentageStat pstat = (PercentageStat)stat; 748 { PercentageStat pstat = (PercentageStat)stat;
749 pstat.Consequent = PacketPool.Instance.BlocksRequested; 749 pstat.Consequent = PacketPool.Instance.BlocksRequested;
750 pstat.Antecedent = PacketPool.Instance.BlocksReused; }, 750 pstat.Antecedent = PacketPool.Instance.BlocksReused; },
751 StatVerbosity.Debug)); 751 StatVerbosity.Debug));
752 752
@@ -799,7 +799,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
799 MeasuresOfInterest.None, 799 MeasuresOfInterest.None,
800 stat => stat.Value = IpahEngine.JobsWaiting, 800 stat => stat.Value = IpahEngine.JobsWaiting,
801 StatVerbosity.Debug)); 801 StatVerbosity.Debug));
802 802
803 StatsManager.RegisterStat( 803 StatsManager.RegisterStat(
804 new Stat( 804 new Stat(
805 "OQRERequestsWaiting", 805 "OQRERequestsWaiting",
@@ -812,7 +812,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
812 MeasuresOfInterest.None, 812 MeasuresOfInterest.None,
813 stat => stat.Value = OqrEngine.JobsWaiting, 813 stat => stat.Value = OqrEngine.JobsWaiting,
814 StatVerbosity.Debug)); 814 StatVerbosity.Debug));
815 815
816 // We delay enabling pool stats to AddScene() instead of Initialize() so that we can distinguish pool stats by 816 // We delay enabling pool stats to AddScene() instead of Initialize() so that we can distinguish pool stats by
817 // scene name 817 // scene name
818 if (UsePools) 818 if (UsePools)
@@ -1012,7 +1012,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1012 if ((outgoingPacket.Buffer.Data[0] & Helpers.MSG_RELIABLE) != 0) 1012 if ((outgoingPacket.Buffer.Data[0] & Helpers.MSG_RELIABLE) != 0)
1013 outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method); 1013 outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method);
1014 1014
1015 // If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will 1015 // If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will
1016 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object 1016 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object
1017 // packet so that it isn't sent before a queued update packet. 1017 // packet so that it isn't sent before a queued update packet.
1018 1018
@@ -1242,7 +1242,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1242 1242
1243 if ((IncomingMalformedPacketCount % 10000) == 0) 1243 if ((IncomingMalformedPacketCount % 10000) == 0)
1244 m_log.WarnFormat( 1244 m_log.WarnFormat(
1245 "[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack. Last was from {1}", 1245 "[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack. Last was from {1}",
1246 IncomingMalformedPacketCount, endPoint); 1246 IncomingMalformedPacketCount, endPoint);
1247 } 1247 }
1248 1248
@@ -1391,7 +1391,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1391 1391
1392 if ((IncomingOrphanedPacketCount % 10000) == 0) 1392 if ((IncomingOrphanedPacketCount % 10000) == 0)
1393 m_log.WarnFormat( 1393 m_log.WarnFormat(
1394 "[LLUDPSERVER]: Received {0} orphaned packets so far. Last was from {1}", 1394 "[LLUDPSERVER]: Received {0} orphaned packets so far. Last was from {1}",
1395 IncomingOrphanedPacketCount, endPoint); 1395 IncomingOrphanedPacketCount, endPoint);
1396 1396
1397 return; 1397 return;
@@ -1482,7 +1482,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1482 { 1482 {
1483 if (packet.Header.Resent) 1483 if (packet.Header.Resent)
1484 m_log.DebugFormat( 1484 m_log.DebugFormat(
1485 "[LLUDPSERVER]: Received a resend of already processed packet #{0}, type {1} from {2}", 1485 "[LLUDPSERVER]: Received a resend of already processed packet #{0}, type {1} from {2}",
1486 packet.Header.Sequence, packet.Type, client.Name); 1486 packet.Header.Sequence, packet.Type, client.Name);
1487 else 1487 else
1488 m_log.WarnFormat( 1488 m_log.WarnFormat(
@@ -1512,7 +1512,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1512 // We don't need to do anything else with ping checks 1512 // We don't need to do anything else with ping checks
1513 StartPingCheckPacket startPing = (StartPingCheckPacket)packet; 1513 StartPingCheckPacket startPing = (StartPingCheckPacket)packet;
1514 CompletePing(udpClient, startPing.PingID.PingID); 1514 CompletePing(udpClient, startPing.PingID.PingID);
1515 1515
1516 if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000) 1516 if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000)
1517 { 1517 {
1518 udpClient.SendPacketStats(); 1518 udpClient.SendPacketStats();
@@ -1677,7 +1677,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1677 m_log.DebugFormat( 1677 m_log.DebugFormat(
1678 "[LLUDPSERVER]: Handling UseCircuitCode request for circuit {0} to {1} from IP {2}", 1678 "[LLUDPSERVER]: Handling UseCircuitCode request for circuit {0} to {1} from IP {2}",
1679 uccp.CircuitCode.Code, Scene.RegionInfo.RegionName, endPoint); 1679 uccp.CircuitCode.Code, Scene.RegionInfo.RegionName, endPoint);
1680 1680
1681 AuthenticateResponse sessionInfo; 1681 AuthenticateResponse sessionInfo;
1682 if (IsClientAuthorized(uccp, out sessionInfo)) 1682 if (IsClientAuthorized(uccp, out sessionInfo))
1683 { 1683 {
@@ -1752,10 +1752,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1752 1752
1753 lock (m_pendingCache) 1753 lock (m_pendingCache)
1754 m_pendingCache.Remove(endPoint); 1754 m_pendingCache.Remove(endPoint);
1755 } 1755 }
1756 1756
1757 // m_log.DebugFormat( 1757 // m_log.DebugFormat(
1758 // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", 1758 // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
1759 // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); 1759 // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
1760 1760
1761 } 1761 }
@@ -1787,9 +1787,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1787 1787
1788 // Determine which agent this packet came from 1788 // Determine which agent this packet came from
1789 // We need to wait here because in when using the OpenSimulator V2 teleport protocol to travel to a destination 1789 // We need to wait here because in when using the OpenSimulator V2 teleport protocol to travel to a destination
1790 // simulator with no existing child presence, the viewer (at least LL 3.3.4) will send UseCircuitCode 1790 // simulator with no existing child presence, the viewer (at least LL 3.3.4) will send UseCircuitCode
1791 // and then CompleteAgentMovement immediately without waiting for an ack. As we are now handling these 1791 // and then CompleteAgentMovement immediately without waiting for an ack. As we are now handling these
1792 // packets asynchronously, we need to account for this thread proceeding more quickly than the 1792 // packets asynchronously, we need to account for this thread proceeding more quickly than the
1793 // UseCircuitCode thread. 1793 // UseCircuitCode thread.
1794 int count = 40; 1794 int count = 40;
1795 while (count-- > 0) 1795 while (count-- > 0)
@@ -1811,7 +1811,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1811 // manager but the SceneAgent has not yet been set in Scene.AddNewAgent(). If we are too 1811 // manager but the SceneAgent has not yet been set in Scene.AddNewAgent(). If we are too
1812 // eager, then the new ScenePresence may not have registered a listener for this messsage 1812 // eager, then the new ScenePresence may not have registered a listener for this messsage
1813 // before we try to process it. 1813 // before we try to process it.
1814 // XXX: A better long term fix may be to add the SceneAgent before the client is added to 1814 // XXX: A better long term fix may be to add the SceneAgent before the client is added to
1815 // the client manager 1815 // the client manager
1816 m_log.DebugFormat( 1816 m_log.DebugFormat(
1817 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client SceneAgent not set yet. Waiting.", 1817 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client SceneAgent not set yet. Waiting.",
@@ -1825,7 +1825,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1825 else 1825 else
1826 { 1826 {
1827 m_log.DebugFormat( 1827 m_log.DebugFormat(
1828 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} in {1} but no client exists yet. Waiting.", 1828 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} in {1} but no client exists yet. Waiting.",
1829 endPoint, Scene.Name); 1829 endPoint, Scene.Name);
1830 } 1830 }
1831 1831
@@ -1962,13 +1962,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1962 { 1962 {
1963 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, Throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); 1963 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, Throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
1964 1964
1965 1965
1966 client = new LLClientView(Scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); 1966 client = new LLClientView(Scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
1967 client.OnLogout += LogoutHandler; 1967 client.OnLogout += LogoutHandler;
1968 client.DebugPacketLevel = DefaultClientPacketDebugLevel; 1968 client.DebugPacketLevel = DefaultClientPacketDebugLevel;
1969 1969
1970 ((LLClientView)client).DisableFacelights = m_disableFacelights; 1970 ((LLClientView)client).DisableFacelights = m_disableFacelights;
1971 1971
1972 client.Start(); 1972 client.Start();
1973 } 1973 }
1974 } 1974 }
@@ -1988,7 +1988,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1988 protected void DeactivateClientDueToTimeout(LLClientView client, int timeoutTicks) 1988 protected void DeactivateClientDueToTimeout(LLClientView client, int timeoutTicks)
1989 { 1989 {
1990 lock (client.CloseSyncLock) 1990 lock (client.CloseSyncLock)
1991 { 1991 {
1992 ClientLogoutsDueToNoReceives++; 1992 ClientLogoutsDueToNoReceives++;
1993 1993
1994 if (client.SceneAgent != null) 1994 if (client.SceneAgent != null)
@@ -1996,7 +1996,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1996 m_log.WarnFormat( 1996 m_log.WarnFormat(
1997 "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.", 1997 "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.",
1998 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, Scene.Name); 1998 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, Scene.Name);
1999 1999
2000 if (!client.SceneAgent.IsChildAgent) 2000 if (!client.SceneAgent.IsChildAgent)
2001 client.Kick("Simulator logged you out due to connection timeout."); 2001 client.Kick("Simulator logged you out due to connection timeout.");
2002 } 2002 }
@@ -2020,11 +2020,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2020 try 2020 try
2021 { 2021 {
2022 incomingPacket = packetInbox.Dequeue(250); 2022 incomingPacket = packetInbox.Dequeue(250);
2023 2023
2024 if (incomingPacket != null && IsRunningInbound) 2024 if (incomingPacket != null && IsRunningInbound)
2025 { 2025 {
2026 ProcessInPacket(incomingPacket); 2026 ProcessInPacket(incomingPacket);
2027 2027
2028 if (UsePools) 2028 if (UsePools)
2029 { 2029 {
2030 incomingPacket.Client = null; 2030 incomingPacket.Client = null;
@@ -2192,7 +2192,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2192 /// </summary> 2192 /// </summary>
2193 public long IncomingPacketsProcessed { get; protected set; } 2193 public long IncomingPacketsProcessed { get; protected set; }
2194 2194
2195 #endregion 2195 #endregion
2196 2196
2197 protected void ProcessInPacket(IncomingPacket incomingPacket) 2197 protected void ProcessInPacket(IncomingPacket incomingPacket)
2198 { 2198 {
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs
index 6e6a2d1..012a57d 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
53 "Comms", false, "show server throttles", 53 "Comms", false, "show server throttles",
54 "show server throttles", 54 "show server throttles",
55 "Show information about server throttles", 55 "Show information about server throttles",
56 HandleShowServerThrottlesCommand); 56 HandleShowServerThrottlesCommand);
57 57
58 m_console.Commands.AddCommand( 58 m_console.Commands.AddCommand(
59 "Debug", false, "debug lludp packet", 59 "Debug", false, "debug lludp packet",
@@ -207,8 +207,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
207 HandleClientGetCommand); 207 HandleClientGetCommand);
208 208
209 m_console.Commands.AddCommand( 209 m_console.Commands.AddCommand(
210 "Debug", 210 "Debug",
211 false, 211 false,
212 "debug lludp client set", 212 "debug lludp client set",
213 "debug lludp client set <param> <value> [<avatar-first-name> <avatar-last-name>]", 213 "debug lludp client set <param> <value> [<avatar-first-name> <avatar-last-name>]",
214 "Set a debug parameter for a particular client. If no name is given then the value is set on all clients.", 214 "Set a debug parameter for a particular client. If no name is given then the value is set on all clients.",
@@ -228,22 +228,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
228 228
229 long maxSceneDripRate = (long)m_udpServer.Throttle.MaxDripRate; 229 long maxSceneDripRate = (long)m_udpServer.Throttle.MaxDripRate;
230 cdl.AddRow( 230 cdl.AddRow(
231 "Max scene throttle", 231 "Max scene throttle",
232 maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset"); 232 maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset");
233 233
234 int maxClientDripRate = m_udpServer.ThrottleRates.Total; 234 int maxClientDripRate = m_udpServer.ThrottleRates.Total;
235 cdl.AddRow( 235 cdl.AddRow(
236 "Max new client throttle", 236 "Max new client throttle",
237 maxClientDripRate != 0 ? string.Format("{0} kbps", maxClientDripRate * 8 / 1000) : "unset"); 237 maxClientDripRate != 0 ? string.Format("{0} kbps", maxClientDripRate * 8 / 1000) : "unset");
238 238
239 m_console.Output(cdl.ToString()); 239 m_console.Output(cdl.ToString());
240 240
241 m_console.OutputFormat("{0}\n", GetServerThrottlesReport(m_udpServer)); 241 m_console.OutputFormat("{0}\n", GetServerThrottlesReport(m_udpServer));
242 } 242 }
243 243
244 private string GetServerThrottlesReport(LLUDPServer udpServer) 244 private string GetServerThrottlesReport(LLUDPServer udpServer)
245 { 245 {
246 StringBuilder report = new StringBuilder(); 246 StringBuilder report = new StringBuilder();
247 247
248 report.AppendFormat( 248 report.AppendFormat(
249 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}\n", 249 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}\n",
@@ -254,7 +254,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
254 "Cloud", 254 "Cloud",
255 "Task", 255 "Task",
256 "Texture", 256 "Texture",
257 "Asset"); 257 "Asset");
258 258
259 report.AppendFormat( 259 report.AppendFormat(
260 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}\n", 260 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}\n",
@@ -265,7 +265,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
265 "kb/s", 265 "kb/s",
266 "kb/s", 266 "kb/s",
267 "kb/s", 267 "kb/s",
268 "kb/s"); 268 "kb/s");
269 269
270 ThrottleRates throttleRates = udpServer.ThrottleRates; 270 ThrottleRates throttleRates = udpServer.ThrottleRates;
271 report.AppendFormat( 271 report.AppendFormat(
@@ -277,16 +277,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
277 (throttleRates.Cloud * 8) / 1000, 277 (throttleRates.Cloud * 8) / 1000,
278 (throttleRates.Task * 8) / 1000, 278 (throttleRates.Task * 8) / 1000,
279 (throttleRates.Texture * 8) / 1000, 279 (throttleRates.Texture * 8) / 1000,
280 (throttleRates.Asset * 8) / 1000); 280 (throttleRates.Asset * 8) / 1000);
281 281
282 return report.ToString(); 282 return report.ToString();
283 } 283 }
284 284
285 protected string GetColumnEntry(string entry, int maxLength, int columnPadding) 285 protected string GetColumnEntry(string entry, int maxLength, int columnPadding)
286 { 286 {
287 return string.Format( 287 return string.Format(
288 "{0,-" + maxLength + "}{1,-" + columnPadding + "}", 288 "{0,-" + maxLength + "}{1,-" + columnPadding + "}",
289 entry.Length > maxLength ? entry.Substring(0, maxLength) : entry, 289 entry.Length > maxLength ? entry.Substring(0, maxLength) : entry,
290 ""); 290 "");
291 } 291 }
292 292
@@ -375,7 +375,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
375 MainConsole.Instance.OutputFormat( 375 MainConsole.Instance.OutputFormat(
376 "Usage: debug lludp throttles set <param> <value> [<avatar-first-name> <avatar-last-name>]"); 376 "Usage: debug lludp throttles set <param> <value> [<avatar-first-name> <avatar-last-name>]");
377 return; 377 return;
378 } 378 }
379 379
380 string param = args[4]; 380 string param = args[4];
381 string rawValue = args[5]; 381 string rawValue = args[5];
@@ -467,7 +467,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
467 MainConsole.Instance.OutputFormat( 467 MainConsole.Instance.OutputFormat(
468 "Usage: debug lludp throttles get [<avatar-first-name> <avatar-last-name>]"); 468 "Usage: debug lludp throttles get [<avatar-first-name> <avatar-last-name>]");
469 return; 469 return;
470 } 470 }
471 471
472 string firstName = null; 472 string firstName = null;
473 string lastName = null; 473 string lastName = null;
@@ -491,7 +491,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
491 ConsoleDisplayList cdl = new ConsoleDisplayList(); 491 ConsoleDisplayList cdl = new ConsoleDisplayList();
492 cdl.AddRow("adaptive", udpClient.FlowThrottle.AdaptiveEnabled); 492 cdl.AddRow("adaptive", udpClient.FlowThrottle.AdaptiveEnabled);
493 cdl.AddRow("current", string.Format("{0} kbps", udpClient.FlowThrottle.DripRate * 8 / 1000)); 493 cdl.AddRow("current", string.Format("{0} kbps", udpClient.FlowThrottle.DripRate * 8 / 1000));
494 cdl.AddRow("request", string.Format("{0} kbps", udpClient.FlowThrottle.RequestedDripRate * 8 / 1000)); 494 cdl.AddRow("request", string.Format("{0} kbps", udpClient.FlowThrottle.RequestedDripRate * 8 / 1000));
495 cdl.AddRow("max", string.Format("{0} kbps", udpClient.FlowThrottle.MaxDripRate * 8 / 1000)); 495 cdl.AddRow("max", string.Format("{0} kbps", udpClient.FlowThrottle.MaxDripRate * 8 / 1000));
496 496
497 m_console.Output(cdl.ToString()); 497 m_console.Output(cdl.ToString());
@@ -509,12 +509,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
509 509
510 long maxSceneDripRate = (long)m_udpServer.Throttle.MaxDripRate; 510 long maxSceneDripRate = (long)m_udpServer.Throttle.MaxDripRate;
511 cdl.AddRow( 511 cdl.AddRow(
512 "max-scene-throttle", 512 "max-scene-throttle",
513 maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset"); 513 maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset");
514 514
515 int maxClientDripRate = m_udpServer.ThrottleRates.Total; 515 int maxClientDripRate = m_udpServer.ThrottleRates.Total;
516 cdl.AddRow( 516 cdl.AddRow(
517 "max-new-client-throttle", 517 "max-new-client-throttle",
518 maxClientDripRate != 0 ? string.Format("{0} kbps", maxClientDripRate * 8 / 1000) : "unset"); 518 maxClientDripRate != 0 ? string.Format("{0} kbps", maxClientDripRate * 8 / 1000) : "unset");
519 519
520 m_console.Output(cdl.ToString()); 520 m_console.Output(cdl.ToString());
@@ -529,7 +529,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
529 { 529 {
530 MainConsole.Instance.OutputFormat("Usage: debug lludp set <param> <value>"); 530 MainConsole.Instance.OutputFormat("Usage: debug lludp set <param> <value>");
531 return; 531 return;
532 } 532 }
533 533
534 string param = args[3]; 534 string param = args[3];
535 string rawValue = args[4]; 535 string rawValue = args[4];
@@ -552,7 +552,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
552 } 552 }
553 else 553 else
554 { 554 {
555 return; 555 return;
556 } 556 }
557 557
558 m_console.OutputFormat("{0} set to {1} in {2}", param, rawValue, m_udpServer.Scene.Name); 558 m_console.OutputFormat("{0} set to {1} in {2}", param, rawValue, m_udpServer.Scene.Name);
@@ -598,7 +598,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
598 { 598 {
599 MainConsole.Instance.OutputFormat("Usage: debug lludp client set <param> <value> [<avatar-first-name> <avatar-last-name>]"); 599 MainConsole.Instance.OutputFormat("Usage: debug lludp client set <param> <value> [<avatar-first-name> <avatar-last-name>]");
600 return; 600 return;
601 } 601 }
602 602
603 string param = args[4]; 603 string param = args[4];
604 string rawValue = args[5]; 604 string rawValue = args[5];
@@ -697,12 +697,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
697 697
698 string direction = args[3]; 698 string direction = args[3];
699 string subCommand = args[4]; 699 string subCommand = args[4];
700 string packetName = args[5]; 700 string packetName = args[5];
701 701
702 if (subCommand == "add") 702 if (subCommand == "add")
703 { 703 {
704 MainConsole.Instance.OutputFormat( 704 MainConsole.Instance.OutputFormat(
705 "Adding packet {0} to {1} drop list for all connections in {2}", 705 "Adding packet {0} to {1} drop list for all connections in {2}",
706 direction, packetName, m_udpServer.Scene.Name); 706 direction, packetName, m_udpServer.Scene.Name);
707 707
708 m_udpServer.Scene.ForEachScenePresence( 708 m_udpServer.Scene.ForEachScenePresence(
@@ -720,7 +720,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
720 else if (subCommand == "remove") 720 else if (subCommand == "remove")
721 { 721 {
722 MainConsole.Instance.OutputFormat( 722 MainConsole.Instance.OutputFormat(
723 "Removing packet {0} from {1} drop list for all connections in {2}", 723 "Removing packet {0} from {1} drop list for all connections in {2}",
724 direction, packetName, m_udpServer.Scene.Name); 724 direction, packetName, m_udpServer.Scene.Name);
725 725
726 m_udpServer.Scene.ForEachScenePresence( 726 m_udpServer.Scene.ForEachScenePresence(
@@ -868,10 +868,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
868 MainConsole.Instance.OutputFormat("OQRE in {0}", m_udpServer.Scene.Name); 868 MainConsole.Instance.OutputFormat("OQRE in {0}", m_udpServer.Scene.Name);
869 MainConsole.Instance.OutputFormat("Running: {0}", m_udpServer.OqrEngine.IsRunning); 869 MainConsole.Instance.OutputFormat("Running: {0}", m_udpServer.OqrEngine.IsRunning);
870 MainConsole.Instance.OutputFormat( 870 MainConsole.Instance.OutputFormat(
871 "Requests waiting: {0}", 871 "Requests waiting: {0}",
872 m_udpServer.OqrEngine.IsRunning ? m_udpServer.OqrEngine.JobsWaiting.ToString() : "n/a"); 872 m_udpServer.OqrEngine.IsRunning ? m_udpServer.OqrEngine.JobsWaiting.ToString() : "n/a");
873 } 873 }
874 else 874 else
875 { 875 {
876 MainConsole.Instance.OutputFormat("Unrecognized OQRE subcommand {0}", subCommand); 876 MainConsole.Instance.OutputFormat("Unrecognized OQRE subcommand {0}", subCommand);
877 } 877 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
index 831381e..35a0711 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
@@ -3,25 +3,25 @@
3 * Original Author: Jeff Cesnik 3 * Original Author: Jeff Cesnik
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * - Redistribution and use in source and binary forms, with or without 6 * - Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * - Redistributions of source code must retain the above copyright notice, this 9 * - Redistributions of source code must retain the above copyright notice, this
10 * list of conditions and the following disclaimer. 10 * list of conditions and the following disclaimer.
11 * - Neither the name of the openmetaverse.org nor the names 11 * - Neither the name of the openmetaverse.org nor the names
12 * of its contributors may be used to endorse or promote products derived from 12 * of its contributors may be used to endorse or promote products derived from
13 * this software without specific prior written permission. 13 * this software without specific prior written permission.
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE. 25 * POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
@@ -107,10 +107,10 @@ namespace OpenMetaverse
107 /// </summary> 107 /// </summary>
108 public float AverageReceiveTicksForLastSamplePeriod { get; private set; } 108 public float AverageReceiveTicksForLastSamplePeriod { get; private set; }
109 109
110 public int Port 110 public int Port
111 { 111 {
112 get { return m_udpPort; } 112 get { return m_udpPort; }
113 } 113 }
114 114
115 #region PacketDropDebugging 115 #region PacketDropDebugging
116 /// <summary> 116 /// <summary>
@@ -118,7 +118,7 @@ namespace OpenMetaverse
118 /// outbound packets. 118 /// outbound packets.
119 /// </summary> 119 /// </summary>
120 private Random m_dropRandomGenerator = new Random(); 120 private Random m_dropRandomGenerator = new Random();
121 121
122 /// <summary> 122 /// <summary>
123 /// For debugging purposes only... parameters for a simplified 123 /// For debugging purposes only... parameters for a simplified
124 /// model of packet loss with bursts, overall drop rate should 124 /// model of packet loss with bursts, overall drop rate should
@@ -137,7 +137,7 @@ namespace OpenMetaverse
137 /// </summary> 137 /// </summary>
138 private int m_dropLastTick = 0; 138 private int m_dropLastTick = 0;
139 private int m_dropResetTicks = 500; 139 private int m_dropResetTicks = 500;
140 140
141 /// <summary> 141 /// <summary>
142 /// Debugging code used to simulate dropped packets with bursts 142 /// Debugging code used to simulate dropped packets with bursts
143 /// </summary> 143 /// </summary>
@@ -187,13 +187,13 @@ namespace OpenMetaverse
187 ~OpenSimUDPBase() 187 ~OpenSimUDPBase()
188 { 188 {
189 if(m_udpSocket !=null) 189 if(m_udpSocket !=null)
190 try { m_udpSocket.Close(); } catch { } 190 try { m_udpSocket.Close(); } catch { }
191 } 191 }
192 /// <summary> 192 /// <summary>
193 /// Start inbound UDP packet handling. 193 /// Start inbound UDP packet handling.
194 /// </summary> 194 /// </summary>
195 /// <param name="recvBufferSize">The size of the receive buffer for 195 /// <param name="recvBufferSize">The size of the receive buffer for
196 /// the UDP socket. This value is passed up to the operating system 196 /// the UDP socket. This value is passed up to the operating system
197 /// and used in the system networking stack. Use zero to leave this 197 /// and used in the system networking stack. Use zero to leave this
198 /// value as the default</param> 198 /// value as the default</param>
199 /// <param name="asyncPacketHandling">Set this to true to start 199 /// <param name="asyncPacketHandling">Set this to true to start
@@ -235,7 +235,7 @@ namespace OpenMetaverse
235 } 235 }
236 try 236 try
237 { 237 {
238 // This udp socket flag is not supported under mono, 238 // This udp socket flag is not supported under mono,
239 // so we'll catch the exception and continue 239 // so we'll catch the exception and continue
240 m_udpSocket.IOControl(SIO_UDP_CONNRESET, new byte[] { 0 }, null); 240 m_udpSocket.IOControl(SIO_UDP_CONNRESET, new byte[] { 0 }, null);
241 m_log.Debug("[UDPBASE]: SIO_UDP_CONNRESET flag set"); 241 m_log.Debug("[UDPBASE]: SIO_UDP_CONNRESET flag set");
@@ -249,12 +249,12 @@ namespace OpenMetaverse
249 // we never want two regions to listen on the same port as they cannot demultiplex each other's messages, 249 // we never want two regions to listen on the same port as they cannot demultiplex each other's messages,
250 // leading to a confusing bug. 250 // leading to a confusing bug.
251 // By default, Windows does not allow two sockets to bind to the same port. 251 // By default, Windows does not allow two sockets to bind to the same port.
252 // 252 //
253 // Unfortunately, this also causes a crashed sim to leave the socket in a state 253 // Unfortunately, this also causes a crashed sim to leave the socket in a state
254 // where it appears to be in use but is really just hung from the old process 254 // where it appears to be in use but is really just hung from the old process
255 // crashing rather than closing it. While this protects agains misconfiguration, 255 // crashing rather than closing it. While this protects agains misconfiguration,
256 // allowing crashed sims to be started up again right away, rather than having to 256 // allowing crashed sims to be started up again right away, rather than having to
257 // wait 2 minutes for the socket to clear is more valuable. Commented 12/13/2016 257 // wait 2 minutes for the socket to clear is more valuable. Commented 12/13/2016
258 // m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false); 258 // m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false);
259 259
260 if (recvBufferSize != 0) 260 if (recvBufferSize != 0)
@@ -262,8 +262,8 @@ namespace OpenMetaverse
262 262
263 m_udpSocket.Bind(ipep); 263 m_udpSocket.Bind(ipep);
264 264
265 if (m_udpPort == 0) 265 if (m_udpPort == 0)
266 m_udpPort = ((IPEndPoint)m_udpSocket.LocalEndPoint).Port; 266 m_udpPort = ((IPEndPoint)m_udpSocket.LocalEndPoint).Port;
267 267
268 IsRunningInbound = true; 268 IsRunningInbound = true;
269 269
@@ -334,7 +334,7 @@ namespace OpenMetaverse
334 { 334 {
335 UDPPacketBuffer buf; 335 UDPPacketBuffer buf;
336 336
337 // FIXME: Disabled for now as this causes issues with reused packet objects interfering with each other 337 // FIXME: Disabled for now as this causes issues with reused packet objects interfering with each other
338 // on Windows with m_asyncPacketHandling = true, though this has not been seen on Linux. 338 // on Windows with m_asyncPacketHandling = true, though this has not been seen on Linux.
339 // Possibly some unexpected issue with fetching UDP data concurrently with multiple threads. Requires more investigation. 339 // Possibly some unexpected issue with fetching UDP data concurrently with multiple threads. Requires more investigation.
340// if (UsePools) 340// if (UsePools)
@@ -387,8 +387,8 @@ namespace OpenMetaverse
387 m_log.Warn("[UDPBASE]: Salvaged the UDP listener on port " + m_udpPort); 387 m_log.Warn("[UDPBASE]: Salvaged the UDP listener on port " + m_udpPort);
388 } 388 }
389 } 389 }
390 catch (ObjectDisposedException e) 390 catch (ObjectDisposedException e)
391 { 391 {
392 m_log.Error( 392 m_log.Error(
393 string.Format("[UDPBASE]: Error processing UDP begin receive {0}. Exception ", UdpReceives), e); 393 string.Format("[UDPBASE]: Error processing UDP begin receive {0}. Exception ", UdpReceives), e);
394 } 394 }
@@ -434,7 +434,7 @@ namespace OpenMetaverse
434 // since this should be rare and won't cause a runtime problem. 434 // since this should be rare and won't cause a runtime problem.
435 if (m_currentReceiveTimeSamples >= s_receiveTimeSamples) 435 if (m_currentReceiveTimeSamples >= s_receiveTimeSamples)
436 { 436 {
437 AverageReceiveTicksForLastSamplePeriod 437 AverageReceiveTicksForLastSamplePeriod
438 = (float)m_receiveTicksInCurrentSamplePeriod / s_receiveTimeSamples; 438 = (float)m_receiveTicksInCurrentSamplePeriod / s_receiveTimeSamples;
439 439
440 m_receiveTicksInCurrentSamplePeriod = 0; 440 m_receiveTicksInCurrentSamplePeriod = 0;
@@ -446,16 +446,16 @@ namespace OpenMetaverse
446 m_currentReceiveTimeSamples++; 446 m_currentReceiveTimeSamples++;
447 } 447 }
448 } 448 }
449 catch (SocketException se) 449 catch (SocketException se)
450 { 450 {
451 m_log.Error( 451 m_log.Error(
452 string.Format( 452 string.Format(
453 "[UDPBASE]: Error processing UDP end receive {0}, socket error code {1}. Exception ", 453 "[UDPBASE]: Error processing UDP end receive {0}, socket error code {1}. Exception ",
454 UdpReceives, se.ErrorCode), 454 UdpReceives, se.ErrorCode),
455 se); 455 se);
456 } 456 }
457 catch (ObjectDisposedException e) 457 catch (ObjectDisposedException e)
458 { 458 {
459 m_log.Error( 459 m_log.Error(
460 string.Format("[UDPBASE]: Error processing UDP end receive {0}. Exception ", UdpReceives), e); 460 string.Format("[UDPBASE]: Error processing UDP end receive {0}. Exception ", UdpReceives), e);
461 } 461 }
@@ -486,7 +486,7 @@ namespace OpenMetaverse
486 // packets when testing throttles & retransmission code 486 // packets when testing throttles & retransmission code
487 // if (DropOutgoingPacket()) 487 // if (DropOutgoingPacket())
488 // return; 488 // return;
489 489
490 try 490 try
491 { 491 {
492 m_udpSocket.BeginSendTo( 492 m_udpSocket.BeginSendTo(
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
index 5a2bcee..f585bea 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
62 /// </summary> 62 /// </summary>
63 public int PacketsPooled 63 public int PacketsPooled
64 { 64 {
65 get 65 get
66 { 66 {
67 lock (pool) 67 lock (pool)
68 return pool.Count; 68 return pool.Count;
@@ -74,9 +74,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
74 /// </summary> 74 /// </summary>
75 public int BlocksPooled 75 public int BlocksPooled
76 { 76 {
77 get 77 get
78 { 78 {
79 lock (DataBlocks) 79 lock (DataBlocks)
80 return DataBlocks.Count; 80 return DataBlocks.Count;
81 } 81 }
82 } 82 }
@@ -248,7 +248,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
248 } 248 }
249 } 249 }
250 break; 250 break;
251 251
252 // Other packets wont pool 252 // Other packets wont pool
253 default: 253 default:
254 return; 254 return;
@@ -276,7 +276,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
276 { 276 {
277 DataBlocks[typeof(T)] = new Stack<Object>(); 277 DataBlocks[typeof(T)] = new Stack<Object>();
278 } 278 }
279 279
280 return new T(); 280 return new T();
281 } 281 }
282 } 282 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
index 1443477..4a8f16d 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
@@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins; 4using Mono.Addins;
5 5
6// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
7// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
8// associated with an assembly. 8// associated with an assembly.
9[assembly: AssemblyTitle("OpenSim.Region.ClientStack.LindenUDP")] 9[assembly: AssemblyTitle("OpenSim.Region.ClientStack.LindenUDP")]
@@ -15,8 +15,8 @@ using Mono.Addins;
15[assembly: AssemblyTrademark("")] 15[assembly: AssemblyTrademark("")]
16[assembly: AssemblyCulture("")] 16[assembly: AssemblyCulture("")]
17 17
18// Setting ComVisible to false makes the types in this assembly not visible 18// Setting ComVisible to false makes the types in this assembly not visible
19// to COM components. If you need to access a type in this assembly from 19// to COM components. If you need to access a type in this assembly from
20// COM, set the ComVisible attribute to true on that type. 20// COM, set the ComVisible attribute to true on that type.
21[assembly: ComVisible(false)] 21[assembly: ComVisible(false)]
22 22
@@ -26,7 +26,7 @@ using Mono.Addins;
26// Version information for an assembly consists of the following four values: 26// Version information for an assembly consists of the following four values:
27// 27//
28// Major Version 28// Major Version
29// Minor Version 29// Minor Version
30// Build Number 30// Build Number
31// Revision 31// Revision
32// 32//
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
index a935dd2..0e1a9e3 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
70 m_scene = new SceneHelpers().SetupScene(); 70 m_scene = new SceneHelpers().SetupScene();
71 StatsManager.SimExtraStats = new SimExtraStatsCollector(); 71 StatsManager.SimExtraStats = new SimExtraStatsCollector();
72 } 72 }
73 73
74// /// <summary> 74// /// <summary>
75// /// Build an object name packet for test purposes 75// /// Build an object name packet for test purposes
76// /// </summary> 76// /// </summary>
@@ -84,7 +84,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
84// odb.Name = Utils.StringToBytes(objectName); 84// odb.Name = Utils.StringToBytes(objectName);
85// onp.ObjectData = new ObjectNamePacket.ObjectDataBlock[] { odb }; 85// onp.ObjectData = new ObjectNamePacket.ObjectDataBlock[] { odb };
86// onp.Header.Zerocoded = false; 86// onp.Header.Zerocoded = false;
87// 87//
88// return onp; 88// return onp;
89// } 89// }
90// 90//
@@ -156,7 +156,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
156 config.Set("AckTimeout", -1); 156 config.Set("AckTimeout", -1);
157 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(m_scene, ics); 157 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(m_scene, ics);
158 158
159 ScenePresence sp 159 ScenePresence sp
160 = ClientStackHelpers.AddChildClient( 160 = ClientStackHelpers.AddChildClient(
161 m_scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); 161 m_scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);
162 162
@@ -175,21 +175,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
175// TestHelper.InMethod(); 175// TestHelper.InMethod();
176// 176//
177// uint myCircuitCode = 123457; 177// uint myCircuitCode = 123457;
178// 178//
179// TestLLUDPServer testLLUDPServer; 179// TestLLUDPServer testLLUDPServer;
180// TestLLPacketServer testLLPacketServer; 180// TestLLPacketServer testLLPacketServer;
181// AgentCircuitManager acm; 181// AgentCircuitManager acm;
182// SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm); 182// SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm);
183// AddClient(myCircuitCode, new IPEndPoint(IPAddress.Loopback, 1000), testLLUDPServer, acm); 183// AddClient(myCircuitCode, new IPEndPoint(IPAddress.Loopback, 1000), testLLUDPServer, acm);
184// 184//
185// testLLUDPServer.RemoveClientCircuit(myCircuitCode); 185// testLLUDPServer.RemoveClientCircuit(myCircuitCode);
186// Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode)); 186// Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode));
187// 187//
188// // Check that removing a non-existent circuit doesn't have any bad effects 188// // Check that removing a non-existent circuit doesn't have any bad effects
189// testLLUDPServer.RemoveClientCircuit(101); 189// testLLUDPServer.RemoveClientCircuit(101);
190// Assert.IsFalse(testLLUDPServer.HasCircuit(101)); 190// Assert.IsFalse(testLLUDPServer.HasCircuit(101));
191// } 191// }
192// 192//
193// /// <summary> 193// /// <summary>
194// /// Make sure that the client stack reacts okay to malformed packets 194// /// Make sure that the client stack reacts okay to malformed packets
195// /// </summary> 195// /// </summary>
@@ -200,8 +200,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
200// 200//
201// uint myCircuitCode = 123458; 201// uint myCircuitCode = 123458;
202// EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 1001); 202// EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 1001);
203// MockScene scene = new MockScene(); 203// MockScene scene = new MockScene();
204// 204//
205// TestLLUDPServer testLLUDPServer; 205// TestLLUDPServer testLLUDPServer;
206// TestLLPacketServer testLLPacketServer; 206// TestLLPacketServer testLLPacketServer;
207// AgentCircuitManager acm; 207// AgentCircuitManager acm;
@@ -213,24 +213,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
213// // Send two garbled 'packets' in succession 213// // Send two garbled 'packets' in succession
214// testLLUDPServer.LoadReceive(data, testEp); 214// testLLUDPServer.LoadReceive(data, testEp);
215// testLLUDPServer.LoadReceive(data, testEp); 215// testLLUDPServer.LoadReceive(data, testEp);
216// testLLUDPServer.ReceiveData(null); 216// testLLUDPServer.ReceiveData(null);
217// 217//
218// // Check that we are still here 218// // Check that we are still here
219// Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode)); 219// Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode));
220// Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(0)); 220// Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(0));
221// 221//
222// // Check that sending a valid packet to same circuit still succeeds 222// // Check that sending a valid packet to same circuit still succeeds
223// Assert.That(scene.ObjectNameCallsReceived, Is.EqualTo(0)); 223// Assert.That(scene.ObjectNameCallsReceived, Is.EqualTo(0));
224// 224//
225// testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "helloooo"), testEp); 225// testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "helloooo"), testEp);
226// testLLUDPServer.ReceiveData(null); 226// testLLUDPServer.ReceiveData(null);
227// 227//
228// Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(1)); 228// Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(1));
229// Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(1)); 229// Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(1));
230// } 230// }
231// 231//
232// /// <summary> 232// /// <summary>
233// /// Test that the stack continues to work even if some client has caused a 233// /// Test that the stack continues to work even if some client has caused a
234// /// SocketException on Socket.BeginReceive() 234// /// SocketException on Socket.BeginReceive()
235// /// </summary> 235// /// </summary>
236// [Test] 236// [Test]
@@ -239,32 +239,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
239// TestHelper.InMethod(); 239// TestHelper.InMethod();
240// 240//
241// MockScene scene = new MockScene(); 241// MockScene scene = new MockScene();
242// 242//
243// uint circuitCodeA = 130000; 243// uint circuitCodeA = 130000;
244// EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300); 244// EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300);
245// UUID agentIdA = UUID.Parse("00000000-0000-0000-0000-000000001300"); 245// UUID agentIdA = UUID.Parse("00000000-0000-0000-0000-000000001300");
246// UUID sessionIdA = UUID.Parse("00000000-0000-0000-0000-000000002300"); 246// UUID sessionIdA = UUID.Parse("00000000-0000-0000-0000-000000002300");
247// 247//
248// uint circuitCodeB = 130001; 248// uint circuitCodeB = 130001;
249// EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301); 249// EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301);
250// UUID agentIdB = UUID.Parse("00000000-0000-0000-0000-000000001301"); 250// UUID agentIdB = UUID.Parse("00000000-0000-0000-0000-000000001301");
251// UUID sessionIdB = UUID.Parse("00000000-0000-0000-0000-000000002301"); 251// UUID sessionIdB = UUID.Parse("00000000-0000-0000-0000-000000002301");
252// 252//
253// TestLLUDPServer testLLUDPServer; 253// TestLLUDPServer testLLUDPServer;
254// TestLLPacketServer testLLPacketServer; 254// TestLLPacketServer testLLPacketServer;
255// AgentCircuitManager acm; 255// AgentCircuitManager acm;
256// SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm); 256// SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
257// AddClient(circuitCodeA, epA, agentIdA, sessionIdA, testLLUDPServer, acm); 257// AddClient(circuitCodeA, epA, agentIdA, sessionIdA, testLLUDPServer, acm);
258// AddClient(circuitCodeB, epB, agentIdB, sessionIdB, testLLUDPServer, acm); 258// AddClient(circuitCodeB, epB, agentIdB, sessionIdB, testLLUDPServer, acm);
259// 259//
260// testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet1"), epA); 260// testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet1"), epA);
261// testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet2"), epB); 261// testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet2"), epB);
262// testLLUDPServer.LoadReceiveWithBeginException(epA); 262// testLLUDPServer.LoadReceiveWithBeginException(epA);
263// testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(2, "packet3"), epB); 263// testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(2, "packet3"), epB);
264// testLLUDPServer.ReceiveData(null); 264// testLLUDPServer.ReceiveData(null);
265// 265//
266// Assert.IsFalse(testLLUDPServer.HasCircuit(circuitCodeA)); 266// Assert.IsFalse(testLLUDPServer.HasCircuit(circuitCodeA));
267// 267//
268// Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(3)); 268// Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(3));
269// Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(3)); 269// Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(3));
270// } 270// }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs
index 92f1fc3..1731aa9 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
59// agent.InventoryFolder = UUID.Zero; 59// agent.InventoryFolder = UUID.Zero;
60// agent.startpos = Vector3.Zero; 60// agent.startpos = Vector3.Zero;
61// agent.CapsPath = "http://wibble.com"; 61// agent.CapsPath = "http://wibble.com";
62// 62//
63// TestLLUDPServer testLLUDPServer; 63// TestLLUDPServer testLLUDPServer;
64// TestLLPacketServer testLLPacketServer; 64// TestLLPacketServer testLLPacketServer;
65// AgentCircuitManager acm; 65// AgentCircuitManager acm;
@@ -67,7 +67,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
67// SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm); 67// SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
68// 68//
69// TestClient testClient = new TestClient(agent, scene); 69// TestClient testClient = new TestClient(agent, scene);
70// 70//
71// LLPacketHandler packetHandler 71// LLPacketHandler packetHandler
72// = new LLPacketHandler(testClient, testLLPacketServer, new ClientStackUserSettings()); 72// = new LLPacketHandler(testClient, testLLPacketServer, new ClientStackUserSettings());
73// 73//
@@ -87,14 +87,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
87// /// <param name="testPacketServer"></param> 87// /// <param name="testPacketServer"></param>
88// /// <param name="acm">Agent circuit manager used in setting up the stack</param> 88// /// <param name="acm">Agent circuit manager used in setting up the stack</param>
89// protected void SetupStack( 89// protected void SetupStack(
90// IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer, 90// IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer,
91// out AgentCircuitManager acm) 91// out AgentCircuitManager acm)
92// { 92// {
93// IConfigSource configSource = new IniConfigSource(); 93// IConfigSource configSource = new IniConfigSource();
94// ClientStackUserSettings userSettings = new ClientStackUserSettings(); 94// ClientStackUserSettings userSettings = new ClientStackUserSettings();
95// testLLUDPServer = new TestLLUDPServer(); 95// testLLUDPServer = new TestLLUDPServer();
96// acm = new AgentCircuitManager(); 96// acm = new AgentCircuitManager();
97// 97//
98// uint port = 666; 98// uint port = 666;
99// testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm); 99// testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm);
100// testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings); 100// testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings);
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
index 5e41dbd..873b1e5 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
@@ -137,7 +137,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
137 Scene scene = new SceneHelpers().SetupScene(); 137 Scene scene = new SceneHelpers().SetupScene();
138 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene); 138 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene);
139 139
140 ScenePresence sp 140 ScenePresence sp
141 = ClientStackHelpers.AddChildClient( 141 = ClientStackHelpers.AddChildClient(
142 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); 142 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);
143 143
@@ -145,7 +145,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
145 145
146 udpServer.Throttle.DebugLevel = 1; 146 udpServer.Throttle.DebugLevel = 1;
147 udpClient.ThrottleDebugLevel = 1; 147 udpClient.ThrottleDebugLevel = 1;
148 148
149 int resendBytes = 1000; 149 int resendBytes = 1000;
150 int landBytes = 2000; 150 int landBytes = 2000;
151 int windBytes = 3000; 151 int windBytes = 3000;
@@ -161,8 +161,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
161 int totalBytes = LLUDPServer.MTU + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes; 161 int totalBytes = LLUDPServer.MTU + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes;
162 162
163 AssertThrottles( 163 AssertThrottles(
164 udpClient, 164 udpClient,
165 LLUDPServer.MTU, landBytes, windBytes, cloudBytes, taskBytes, 165 LLUDPServer.MTU, landBytes, windBytes, cloudBytes, taskBytes,
166 textureBytes, assetBytes, totalBytes, 0, 0); 166 textureBytes, assetBytes, totalBytes, 0, 0);
167 } 167 }
168 168
@@ -181,7 +181,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
181 181
182 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene, ics); 182 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene, ics);
183 183
184 ScenePresence sp 184 ScenePresence sp
185 = ClientStackHelpers.AddChildClient( 185 = ClientStackHelpers.AddChildClient(
186 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); 186 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);
187 187
@@ -207,7 +207,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
207 double commitRatio = 32000.0 / totalBytes; 207 double commitRatio = 32000.0 / totalBytes;
208 208
209 AssertThrottles( 209 AssertThrottles(
210 udpClient, 210 udpClient,
211 LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, 211 LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio,
212 textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); 212 textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0);
213 213
@@ -217,7 +217,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
217 commitRatio = (32000.0 + 20.0 * LLUDPServer.MTU) / totalBytes; 217 commitRatio = (32000.0 + 20.0 * LLUDPServer.MTU) / totalBytes;
218 218
219 AssertThrottles( 219 AssertThrottles(
220 udpClient, 220 udpClient,
221 LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, 221 LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio,
222 textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); 222 textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0);
223 223
@@ -227,7 +227,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
227 commitRatio = (32000.0 + (20.0 * LLUDPServer.MTU)/Math.Pow(2,1)) / totalBytes; 227 commitRatio = (32000.0 + (20.0 * LLUDPServer.MTU)/Math.Pow(2,1)) / totalBytes;
228 228
229 AssertThrottles( 229 AssertThrottles(
230 udpClient, 230 udpClient,
231 LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, 231 LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio,
232 textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); 232 textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0);
233 } 233 }
@@ -248,14 +248,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
248 int taskBytes = 14000; 248 int taskBytes = 14000;
249 int textureBytes = 16000; 249 int textureBytes = 16000;
250 int assetBytes = 18000; 250 int assetBytes = 18000;
251 int totalBytes 251 int totalBytes
252 = (int)((resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes) / 2); 252 = (int)((resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes) / 2);
253 253
254 Scene scene = new SceneHelpers().SetupScene(); 254 Scene scene = new SceneHelpers().SetupScene();
255 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene); 255 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene);
256 udpServer.Throttle.RequestedDripRate = totalBytes; 256 udpServer.Throttle.RequestedDripRate = totalBytes;
257 257
258 ScenePresence sp1 258 ScenePresence sp1
259 = ClientStackHelpers.AddChildClient( 259 = ClientStackHelpers.AddChildClient(
260 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); 260 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);
261 261
@@ -265,8 +265,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
265 udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); 265 udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
266 266
267 AssertThrottles( 267 AssertThrottles(
268 udpClient1, 268 udpClient1,
269 resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2, 269 resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2,
270 textureBytes / 2, assetBytes / 2, totalBytes, 0, 0); 270 textureBytes / 2, assetBytes / 2, totalBytes, 0, 0);
271 271
272 // Test: Now add another client 272 // Test: Now add another client
@@ -281,13 +281,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
281 udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); 281 udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
282 282
283 AssertThrottles( 283 AssertThrottles(
284 udpClient1, 284 udpClient1,
285 resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4, 285 resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4,
286 textureBytes / 4, assetBytes / 4, totalBytes / 2, 0, 0); 286 textureBytes / 4, assetBytes / 4, totalBytes / 2, 0, 0);
287 287
288 AssertThrottles( 288 AssertThrottles(
289 udpClient2, 289 udpClient2,
290 resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4, 290 resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4,
291 textureBytes / 4, assetBytes / 4, totalBytes / 2, 0, 0); 291 textureBytes / 4, assetBytes / 4, totalBytes / 2, 0, 0);
292 } 292 }
293 293
@@ -307,14 +307,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
307 int taskBytes = 12000; 307 int taskBytes = 12000;
308 int textureBytes = 14000; 308 int textureBytes = 14000;
309 int assetBytes = 16000; 309 int assetBytes = 16000;
310 int totalBytes 310 int totalBytes
311 = (int)((resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes) / 2); 311 = (int)((resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes) / 2);
312 312
313 Scene scene = new SceneHelpers().SetupScene(); 313 Scene scene = new SceneHelpers().SetupScene();
314 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene); 314 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene);
315 udpServer.ThrottleRates.Total = totalBytes; 315 udpServer.ThrottleRates.Total = totalBytes;
316 316
317 ScenePresence sp 317 ScenePresence sp
318 = ClientStackHelpers.AddChildClient( 318 = ClientStackHelpers.AddChildClient(
319 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); 319 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);
320 320
@@ -325,8 +325,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
325 udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); 325 udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
326 326
327 AssertThrottles( 327 AssertThrottles(
328 udpClient, 328 udpClient,
329 resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2, 329 resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2,
330 textureBytes / 2, assetBytes / 2, totalBytes, 0, totalBytes); 330 textureBytes / 2, assetBytes / 2, totalBytes, 0, totalBytes);
331 } 331 }
332 332
@@ -352,7 +352,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
352 udpServer.ThrottleRates.Total = (int)(totalBytes * 1.1); 352 udpServer.ThrottleRates.Total = (int)(totalBytes * 1.1);
353 udpServer.Throttle.RequestedDripRate = (int)(totalBytes * 1.5); 353 udpServer.Throttle.RequestedDripRate = (int)(totalBytes * 1.5);
354 354
355 ScenePresence sp1 355 ScenePresence sp1
356 = ClientStackHelpers.AddChildClient( 356 = ClientStackHelpers.AddChildClient(
357 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); 357 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);
358 358
@@ -363,8 +363,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
363 udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); 363 udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
364 364
365 AssertThrottles( 365 AssertThrottles(
366 udpClient1, 366 udpClient1,
367 resendBytes, landBytes, windBytes, cloudBytes, taskBytes, 367 resendBytes, landBytes, windBytes, cloudBytes, taskBytes,
368 textureBytes, assetBytes, totalBytes, 0, totalBytes * 1.1); 368 textureBytes, assetBytes, totalBytes, 0, totalBytes * 1.1);
369 369
370 // Now add another client 370 // Now add another client
@@ -379,25 +379,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
379 udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); 379 udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
380 380
381 AssertThrottles( 381 AssertThrottles(
382 udpClient1, 382 udpClient1,
383 resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75, 383 resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75,
384 textureBytes * 0.75, assetBytes * 0.75, totalBytes * 0.75, 0, totalBytes * 1.1); 384 textureBytes * 0.75, assetBytes * 0.75, totalBytes * 0.75, 0, totalBytes * 1.1);
385 385
386 AssertThrottles( 386 AssertThrottles(
387 udpClient2, 387 udpClient2,
388 resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75, 388 resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75,
389 textureBytes * 0.75, assetBytes * 0.75, totalBytes * 0.75, 0, totalBytes * 1.1); 389 textureBytes * 0.75, assetBytes * 0.75, totalBytes * 0.75, 0, totalBytes * 1.1);
390 } 390 }
391 391
392 private void AssertThrottles( 392 private void AssertThrottles(
393 LLUDPClient udpClient, 393 LLUDPClient udpClient,
394 double resendBytes, double landBytes, double windBytes, double cloudBytes, double taskBytes, double textureBytes, double assetBytes, 394 double resendBytes, double landBytes, double windBytes, double cloudBytes, double taskBytes, double textureBytes, double assetBytes,
395 double totalBytes, double targetBytes, double maxBytes) 395 double totalBytes, double targetBytes, double maxBytes)
396 { 396 {
397 ClientInfo ci = udpClient.GetClientInfo(); 397 ClientInfo ci = udpClient.GetClientInfo();
398 398
399// Console.WriteLine( 399// Console.WriteLine(
400// "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", 400// "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}",
401// ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); 401// ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle);
402 402
403 Assert.AreEqual((int)resendBytes, ci.resendThrottle, "Resend"); 403 Assert.AreEqual((int)resendBytes, ci.resendThrottle, "Resend");
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs
index 6278e36..f8ec97a 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs
@@ -58,14 +58,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
58 58
59 /// <summary>Flag used to enable adaptive throttles</summary> 59 /// <summary>Flag used to enable adaptive throttles</summary>
60 public bool AdaptiveThrottlesEnabled; 60 public bool AdaptiveThrottlesEnabled;
61 61
62 /// <summary> 62 /// <summary>
63 /// Set the minimum rate that the adaptive throttles can set. The viewer 63 /// Set the minimum rate that the adaptive throttles can set. The viewer
64 /// can still throttle lower than this, but the adaptive throttles will 64 /// can still throttle lower than this, but the adaptive throttles will
65 /// never decrease rates below this no matter how many packets are dropped 65 /// never decrease rates below this no matter how many packets are dropped
66 /// </summary> 66 /// </summary>
67 public Int64 MinimumAdaptiveThrottleRate; 67 public Int64 MinimumAdaptiveThrottleRate;
68 68
69 /// <summary>Amount of the texture throttle to steal for the task throttle</summary> 69 /// <summary>Amount of the texture throttle to steal for the task throttle</summary>
70 public double CannibalizeTextureRate; 70 public double CannibalizeTextureRate;
71 71
@@ -109,7 +109,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
109// CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f); 109// CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f);
110// CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9); 110// CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9);
111 CannibalizeTextureRate = 0f; 111 CannibalizeTextureRate = 0f;
112 112
113 } 113 }
114 catch (Exception) { } 114 catch (Exception) { }
115 } 115 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
index cac57b2..1daf091 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
@@ -44,24 +44,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 private static Int32 m_counter = 0; 46 private static Int32 m_counter = 0;
47 47
48// private Int32 m_identifier; 48// private Int32 m_identifier;
49 49
50 protected const float m_timeScale = 1e-3f; 50 protected const float m_timeScale = 1e-3f;
51 51
52 /// <summary> 52 /// <summary>
53 /// This is the number of m_minimumDripRate bytes 53 /// This is the number of m_minimumDripRate bytes
54 /// allowed in a burst 54 /// allowed in a burst
55 /// roughtly, with this settings, the maximum time system will take 55 /// roughtly, with this settings, the maximum time system will take
56 /// to recheck a bucket in ms 56 /// to recheck a bucket in ms
57 /// 57 ///
58 /// </summary> 58 /// </summary>
59 protected const float m_quantumsPerBurst = 5; 59 protected const float m_quantumsPerBurst = 5;
60 60
61 /// <summary> 61 /// <summary>
62 /// </summary> 62 /// </summary>
63 protected const float m_minimumDripRate = 1500; 63 protected const float m_minimumDripRate = 1500;
64 64
65 /// <summary>Time of the last drip</summary> 65 /// <summary>Time of the last drip</summary>
66 protected double m_lastDrip; 66 protected double m_lastDrip;
67 67
@@ -76,7 +76,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
76 /// </summary> 76 /// </summary>
77 77
78 protected Dictionary<TokenBucket, float> m_children = new Dictionary<TokenBucket, float>(); 78 protected Dictionary<TokenBucket, float> m_children = new Dictionary<TokenBucket, float>();
79 79
80#region Properties 80#region Properties
81 81
82 /// <summary> 82 /// <summary>
@@ -92,7 +92,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
92 } 92 }
93 /// <summary> 93 /// <summary>
94 /// This is the maximum number 94 /// This is the maximum number
95 /// of tokens that can accumulate in the bucket at any one time. This 95 /// of tokens that can accumulate in the bucket at any one time. This
96 /// also sets the total request for leaf nodes 96 /// also sets the total request for leaf nodes
97 /// </summary> 97 /// </summary>
98 protected float m_burst; 98 protected float m_burst;
@@ -127,14 +127,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
127 return (float)rate; 127 return (float)rate;
128 } 128 }
129 } 129 }
130 130
131 /// <summary> 131 /// <summary>
132 /// The requested drip rate for this particular bucket. 132 /// The requested drip rate for this particular bucket.
133 /// </summary> 133 /// </summary>
134 /// <remarks> 134 /// <remarks>
135 /// 0 then TotalDripRequest is used instead. 135 /// 0 then TotalDripRequest is used instead.
136 /// Can never be above MaxDripRate. 136 /// Can never be above MaxDripRate.
137 /// Tokens are added to the bucket at any time 137 /// Tokens are added to the bucket at any time
138 /// <seealso cref="RemoveTokens"/> is called, at the granularity of 138 /// <seealso cref="RemoveTokens"/> is called, at the granularity of
139 /// the system tick interval (typically around 15-22ms)</remarks> 139 /// the system tick interval (typically around 15-22ms)</remarks>
140 protected float m_dripRate; 140 protected float m_dripRate;
@@ -170,12 +170,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
170 /// The current total of the requested maximum burst rates of children buckets. 170 /// The current total of the requested maximum burst rates of children buckets.
171 /// </summary> 171 /// </summary>
172 protected float m_totalDripRequest; 172 protected float m_totalDripRequest;
173 public float TotalDripRequest 173 public float TotalDripRequest
174 { 174 {
175 get { return m_totalDripRequest; } 175 get { return m_totalDripRequest; }
176 set { m_totalDripRequest = value; } 176 set { m_totalDripRequest = value; }
177 } 177 }
178 178
179#endregion Properties 179#endregion Properties
180 180
181#region Constructor 181#region Constructor
@@ -191,7 +191,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
191 /// zero if this bucket has no maximum capacity</param> 191 /// zero if this bucket has no maximum capacity</param>
192 /// <param name="dripRate">Rate that the bucket fills, in bytes per 192 /// <param name="dripRate">Rate that the bucket fills, in bytes per
193 /// second. If zero, the bucket always remains full</param> 193 /// second. If zero, the bucket always remains full</param>
194 public TokenBucket(TokenBucket parent, float dripRate, float MaxBurst) 194 public TokenBucket(TokenBucket parent, float dripRate, float MaxBurst)
195 { 195 {
196 m_counter++; 196 m_counter++;
197 197
@@ -240,7 +240,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
240 foreach (KeyValuePair<TokenBucket, float> cref in m_children) 240 foreach (KeyValuePair<TokenBucket, float> cref in m_children)
241 m_totalDripRequest += cref.Value; 241 m_totalDripRequest += cref.Value;
242 } 242 }
243 243
244 // Pass the new values up to the parent 244 // Pass the new values up to the parent
245 if (m_parent != null) 245 if (m_parent != null)
246 m_parent.RegisterRequest(this, Math.Min(RequestedDripRate, TotalDripRequest)); 246 m_parent.RegisterRequest(this, Math.Min(RequestedDripRate, TotalDripRequest));
@@ -265,7 +265,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
265 if (Parent != null) 265 if (Parent != null)
266 Parent.RegisterRequest(this,Math.Min(RequestedDripRate, TotalDripRequest)); 266 Parent.RegisterRequest(this,Math.Min(RequestedDripRate, TotalDripRequest));
267 } 267 }
268 268
269 /// <summary> 269 /// <summary>
270 /// Remove a given number of tokens from the bucket 270 /// Remove a given number of tokens from the bucket
271 /// </summary> 271 /// </summary>
@@ -302,7 +302,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
302 302
303 /// <summary> 303 /// <summary>
304 /// Add tokens to the bucket over time. The number of tokens added each 304 /// Add tokens to the bucket over time. The number of tokens added each
305 /// call depends on the length of time that has passed since the last 305 /// call depends on the length of time that has passed since the last
306 /// call to Drip 306 /// call to Drip
307 /// </summary> 307 /// </summary>
308 /// <returns>True if tokens were added to the bucket, otherwise false</returns> 308 /// <returns>True if tokens were added to the bucket, otherwise false</returns>
@@ -315,7 +315,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
315 m_log.WarnFormat("[TOKENBUCKET] something odd is happening and drip rate is 0 for {0}", m_counter); 315 m_log.WarnFormat("[TOKENBUCKET] something odd is happening and drip rate is 0 for {0}", m_counter);
316 return; 316 return;
317 } 317 }
318 318
319 double now = Util.GetTimeStampMS(); 319 double now = Util.GetTimeStampMS();
320 double deltaMS = now - m_lastDrip; 320 double deltaMS = now - m_lastDrip;
321 m_lastDrip = now; 321 m_lastDrip = now;
@@ -333,13 +333,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
333 333
334 public class AdaptiveTokenBucket : TokenBucket 334 public class AdaptiveTokenBucket : TokenBucket
335 { 335 {
336 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 336 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
337 337
338 public bool AdaptiveEnabled { get; set; } 338 public bool AdaptiveEnabled { get; set; }
339 339
340 /// <summary> 340 /// <summary>
341 /// The minimum rate for flow control. Minimum drip rate is one 341 /// The minimum rate for flow control. Minimum drip rate is one
342 /// packet per second. 342 /// packet per second.
343 /// </summary> 343 /// </summary>
344 344
345 protected const float m_minimumFlow = 50000; 345 protected const float m_minimumFlow = 50000;
@@ -361,7 +361,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
361 private bool m_enabled = false; 361 private bool m_enabled = false;
362 362
363 // <summary> 363 // <summary>
364 // Adjust drip rate in response to network conditions. 364 // Adjust drip rate in response to network conditions.
365 // </summary> 365 // </summary>
366 public float AdjustedDripRate 366 public float AdjustedDripRate
367 { 367 {
@@ -374,10 +374,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
374 m_parent.RegisterRequest(this, m_dripRate); 374 m_parent.RegisterRequest(this, m_dripRate);
375 } 375 }
376 } 376 }
377 377
378 378
379 // <summary> 379 // <summary>
380 // 380 //
381 // </summary> 381 // </summary>
382 public AdaptiveTokenBucket(TokenBucket parent, float maxDripRate, float maxBurst, bool enabled) 382 public AdaptiveTokenBucket(TokenBucket parent, float maxDripRate, float maxBurst, bool enabled)
383 : base(parent, maxDripRate, maxBurst) 383 : base(parent, maxDripRate, maxBurst)
@@ -393,7 +393,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
393 if (m_parent != null) 393 if (m_parent != null)
394 m_parent.RegisterRequest(this, m_dripRate); 394 m_parent.RegisterRequest(this, m_dripRate);
395 } 395 }
396 396
397 /// <summary> 397 /// <summary>
398 /// Reliable packets sent to the client for which we never received an ack adjust the drip rate down. 398 /// Reliable packets sent to the client for which we never received an ack adjust the drip rate down.
399 /// <param name="packets">Number of packets that expired without successful delivery</param> 399 /// <param name="packets">Number of packets that expired without successful delivery</param>
@@ -406,7 +406,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
406 } 406 }
407 407
408 // <summary> 408 // <summary>
409 // 409 //
410 // </summary> 410 // </summary>
411 public void AcknowledgePackets(Int32 count) 411 public void AcknowledgePackets(Int32 count)
412 { 412 {
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs
index c9d5697..76f4c6f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
80 m_packets.Clear(); 80 m_packets.Clear();
81 m_pendingAdds = null; 81 m_pendingAdds = null;
82 m_pendingAcknowledgements = null; 82 m_pendingAcknowledgements = null;
83 m_pendingRemoves = null; 83 m_pendingRemoves = null;
84 } 84 }
85 85
86 /// <summary> 86 /// <summary>
@@ -94,7 +94,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
94 public void Add(OutgoingPacket packet) 94 public void Add(OutgoingPacket packet)
95 { 95 {
96 m_pendingAdds.Enqueue(packet); 96 m_pendingAdds.Enqueue(packet);
97 Interlocked.Add(ref packet.Client.UnackedBytes, packet.Buffer.DataLength); 97 Interlocked.Add(ref packet.Client.UnackedBytes, packet.Buffer.DataLength);
98 } 98 }
99 99
100 /// <summary> 100 /// <summary>
@@ -116,7 +116,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
116 /// <summary> 116 /// <summary>
117 /// Marks a packet as no longer needing acknowledgement without a received acknowledgement. 117 /// Marks a packet as no longer needing acknowledgement without a received acknowledgement.
118 /// This method is called when a packet expires and we no longer need an acknowledgement. 118 /// This method is called when a packet expires and we no longer need an acknowledgement.
119 /// When some reliable packet types expire, they are handled in a way other than simply 119 /// When some reliable packet types expire, they are handled in a way other than simply
120 /// resending them. The only effect of removal this way is to update unacked byte count. 120 /// resending them. The only effect of removal this way is to update unacked byte count.
121 /// </summary> 121 /// </summary>
122 /// <param name="sequenceNumber">Sequence number of the packet to 122 /// <param name="sequenceNumber">Sequence number of the packet to
@@ -155,7 +155,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
155 155
156 foreach (OutgoingPacket packet in m_packets.Values) 156 foreach (OutgoingPacket packet in m_packets.Values)
157 { 157 {
158 // TickCount of zero means a packet is in the resend queue 158 // TickCount of zero means a packet is in the resend queue
159 // but hasn't actually been sent over the wire yet 159 // but hasn't actually been sent over the wire yet
160 if (packet.TickCount == 0) 160 if (packet.TickCount == 0)
161 continue; 161 continue;
@@ -172,7 +172,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
172 // As with other network applications, assume that an expired packet is 172 // As with other network applications, assume that an expired packet is
173 // an indication of some network problem, slow transmission 173 // an indication of some network problem, slow transmission
174 packet.Client.FlowThrottle.ExpirePackets(1); 174 packet.Client.FlowThrottle.ExpirePackets(1);
175 175
176 expiredPackets.Add(packet); 176 expiredPackets.Add(packet);
177 } 177 }
178 } 178 }
@@ -191,7 +191,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
191 while (m_pendingAdds.TryDequeue(out pendingAdd)) 191 while (m_pendingAdds.TryDequeue(out pendingAdd))
192 if (pendingAdd != null) 192 if (pendingAdd != null)
193 m_packets[pendingAdd.SequenceNumber] = pendingAdd; 193 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
194 194
195 // Process all the pending removes, including updating statistics and round-trip times 195 // Process all the pending removes, including updating statistics and round-trip times
196 PendingAck pendingAcknowledgement; 196 PendingAck pendingAcknowledgement;
197 while (m_pendingAcknowledgements.TryDequeue(out pendingAcknowledgement)) 197 while (m_pendingAcknowledgements.TryDequeue(out pendingAcknowledgement))
@@ -228,7 +228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
228 else 228 else
229 { 229 {
230 // m_log.WarnFormat("[UNACKED PACKET COLLECTION]: Could not find packet with sequence number {0} to ack", 230 // m_log.WarnFormat("[UNACKED PACKET COLLECTION]: Could not find packet with sequence number {0} to ack",
231 // pendingAcknowledgement.SequenceNumber); 231 // pendingAcknowledgement.SequenceNumber);
232 } 232 }
233 } 233 }
234 234