aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs10
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs12
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs69
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs10
4 files changed, 69 insertions, 32 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
index 908f628..6ec1115 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
@@ -501,7 +501,8 @@ namespace OpenSim.Region.ClientStack.Linden
501 ScenePresence p; 501 ScenePresence p;
502 if (m_scene.TryGetScenePresence(User, out p)) // If we don't get a user they're not here anymore. 502 if (m_scene.TryGetScenePresence(User, out p)) // If we don't get a user they're not here anymore.
503 { 503 {
504 AlterThrottle(UserSetThrottle, p); 504// AlterThrottle(UserSetThrottle, p);
505 UpdateThrottle(UserSetThrottle, p);
505 } 506 }
506 } 507 }
507 } 508 }
@@ -546,7 +547,12 @@ namespace OpenSim.Region.ClientStack.Linden
546 // Client set throttle ! 547 // Client set throttle !
547 UserSetThrottle = pimagethrottle; 548 UserSetThrottle = pimagethrottle;
548 CapSetThrottle = (int)(pimagethrottle*CapThrottleDistributon); 549 CapSetThrottle = (int)(pimagethrottle*CapThrottleDistributon);
549 UDPSetThrottle = (int) (pimagethrottle*(100 - CapThrottleDistributon)); 550// UDPSetThrottle = (int) (pimagethrottle*(100 - CapThrottleDistributon));
551
552 float udp = 1.0f - CapThrottleDistributon;
553 if(udp < 0.5f)
554 udp = 0.5f;
555 UDPSetThrottle = (int) ((float)pimagethrottle * udp);
550 if (CapSetThrottle < 4068) 556 if (CapSetThrottle < 4068)
551 CapSetThrottle = 4068; // at least two discovery mesh 557 CapSetThrottle = 4068; // at least two discovery mesh
552 p.ControllingClient.SetAgentThrottleSilent((int) Throttle, UDPSetThrottle); 558 p.ControllingClient.SetAgentThrottleSilent((int) Throttle, UDPSetThrottle);
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 0a865ab..9550b5a 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -1607,7 +1607,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1607 1607
1608 if (localIDs.Count == 1 && m_scene.GetScenePresence(localIDs[0]) != null) 1608 if (localIDs.Count == 1 && m_scene.GetScenePresence(localIDs[0]) != null)
1609 { 1609 {
1610 OutPacket(kill, ThrottleOutPacketType.State); 1610 OutPacket(kill, ThrottleOutPacketType.Task);
1611 } 1611 }
1612 else 1612 else
1613 { 1613 {
@@ -2788,7 +2788,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2788 Transfer.TransferInfo.Size = req.AssetInf.Data.Length; 2788 Transfer.TransferInfo.Size = req.AssetInf.Data.Length;
2789 Transfer.TransferInfo.TransferID = req.TransferRequestID; 2789 Transfer.TransferInfo.TransferID = req.TransferRequestID;
2790 Transfer.Header.Zerocoded = true; 2790 Transfer.Header.Zerocoded = true;
2791 OutPacket(Transfer, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); 2791 OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2792 2792
2793 if (req.NumPackets == 1) 2793 if (req.NumPackets == 1)
2794 { 2794 {
@@ -2799,7 +2799,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2799 TransferPacket.TransferData.Data = req.AssetInf.Data; 2799 TransferPacket.TransferData.Data = req.AssetInf.Data;
2800 TransferPacket.TransferData.Status = 1; 2800 TransferPacket.TransferData.Status = 1;
2801 TransferPacket.Header.Zerocoded = true; 2801 TransferPacket.Header.Zerocoded = true;
2802 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); 2802 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2803 } 2803 }
2804 else 2804 else
2805 { 2805 {
@@ -2832,7 +2832,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2832 TransferPacket.TransferData.Status = 1; 2832 TransferPacket.TransferData.Status = 1;
2833 } 2833 }
2834 TransferPacket.Header.Zerocoded = true; 2834 TransferPacket.Header.Zerocoded = true;
2835 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); 2835 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2836 2836
2837 processedLength += chunkSize; 2837 processedLength += chunkSize;
2838 packetNumber++; 2838 packetNumber++;
@@ -3605,7 +3605,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3605 } 3605 }
3606 } 3606 }
3607 3607
3608 OutPacket(aw, ThrottleOutPacketType.State); 3608 OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
3609 } 3609 }
3610 3610
3611 public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) 3611 public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
@@ -3630,7 +3630,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3630 avp.Sender.IsTrial = false; 3630 avp.Sender.IsTrial = false;
3631 avp.Sender.ID = agentID; 3631 avp.Sender.ID = agentID;
3632 m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); 3632 m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
3633 OutPacket(avp, ThrottleOutPacketType.State); 3633 OutPacket(avp, ThrottleOutPacketType.Task);
3634 } 3634 }
3635 3635
3636 public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) 3636 public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index f675377..e52ac37 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -92,7 +92,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
92 /// <summary>Packets we have sent that need to be ACKed by the client</summary> 92 /// <summary>Packets we have sent that need to be ACKed by the client</summary>
93 public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection(); 93 public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection();
94 /// <summary>ACKs that are queued up, waiting to be sent to the client</summary> 94 /// <summary>ACKs that are queued up, waiting to be sent to the client</summary>
95 public readonly OpenSim.Framework.LocklessQueue<uint> PendingAcks = new OpenSim.Framework.LocklessQueue<uint>(); 95 public readonly DoubleLocklessQueue<uint> PendingAcks = new DoubleLocklessQueue<uint>();
96 96
97 /// <summary>Current packet sequence number</summary> 97 /// <summary>Current packet sequence number</summary>
98 public int CurrentSequence; 98 public int CurrentSequence;
@@ -146,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
146 /// <summary>Throttle buckets for each packet category</summary> 146 /// <summary>Throttle buckets for each packet category</summary>
147 private readonly TokenBucket[] m_throttleCategories; 147 private readonly TokenBucket[] m_throttleCategories;
148 /// <summary>Outgoing queues for throttled packets</summary> 148 /// <summary>Outgoing queues for throttled packets</summary>
149 private readonly OpenSim.Framework.LocklessQueue<OutgoingPacket>[] m_packetOutboxes = new OpenSim.Framework.LocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT]; 149 private readonly DoubleLocklessQueue<OutgoingPacket>[] m_packetOutboxes = new DoubleLocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT];
150 /// <summary>A container that can hold one packet for each outbox, used to store 150 /// <summary>A container that can hold one packet for each outbox, used to store
151 /// dequeued packets that are being held for throttling</summary> 151 /// dequeued packets that are being held for throttling</summary>
152 private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT]; 152 private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT];
@@ -202,7 +202,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
202 ThrottleOutPacketType type = (ThrottleOutPacketType)i; 202 ThrottleOutPacketType type = (ThrottleOutPacketType)i;
203 203
204 // Initialize the packet outboxes, where packets sit while they are waiting for tokens 204 // Initialize the packet outboxes, where packets sit while they are waiting for tokens
205 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>(); 205 m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
206 // Initialize the token buckets that control the throttling for each category 206 // Initialize the token buckets that control the throttling for each category
207 m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type)); 207 m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type));
208 } 208 }
@@ -279,7 +279,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
279 public string GetStats() 279 public string GetStats()
280 { 280 {
281 return string.Format( 281 return string.Format(
282 "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7} {12,7}", 282 "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}",
283 Util.EnvironmentTickCountSubtract(TickLastPacketReceived), 283 Util.EnvironmentTickCountSubtract(TickLastPacketReceived),
284 PacketsReceived, 284 PacketsReceived,
285 PacketsSent, 285 PacketsSent,
@@ -291,8 +291,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
291 m_packetOutboxes[(int)ThrottleOutPacketType.Cloud].Count, 291 m_packetOutboxes[(int)ThrottleOutPacketType.Cloud].Count,
292 m_packetOutboxes[(int)ThrottleOutPacketType.Task].Count, 292 m_packetOutboxes[(int)ThrottleOutPacketType.Task].Count,
293 m_packetOutboxes[(int)ThrottleOutPacketType.Texture].Count, 293 m_packetOutboxes[(int)ThrottleOutPacketType.Texture].Count,
294 m_packetOutboxes[(int)ThrottleOutPacketType.Asset].Count, 294 m_packetOutboxes[(int)ThrottleOutPacketType.Asset].Count);
295 m_packetOutboxes[(int)ThrottleOutPacketType.State].Count);
296 } 295 }
297 296
298 public void SendPacketStats() 297 public void SendPacketStats()
@@ -338,8 +337,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
338 int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; 337 int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
339 int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; 338 int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
340 int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); 339 int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
341 // State is a subcategory of task that we allocate a percentage to
342 int state = 0;
343 340
344 // Make sure none of the throttles are set below our packet MTU, 341 // Make sure none of the throttles are set below our packet MTU,
345 // otherwise a throttle could become permanently clogged 342 // otherwise a throttle could become permanently clogged
@@ -376,9 +373,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
376 bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task]; 373 bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task];
377 bucket.RequestedDripRate = task; 374 bucket.RequestedDripRate = task;
378 375
379 bucket = m_throttleCategories[(int)ThrottleOutPacketType.State];
380 bucket.RequestedDripRate = state;
381
382 bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; 376 bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture];
383 bucket.RequestedDripRate = texture; 377 bucket.RequestedDripRate = texture;
384 378
@@ -436,15 +430,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
436 /// </returns> 430 /// </returns>
437 public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue) 431 public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue)
438 { 432 {
433 return EnqueueOutgoing(packet, forceQueue, false);
434 }
435
436 public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue, bool highPriority)
437 {
439 int category = (int)packet.Category; 438 int category = (int)packet.Category;
440 439
441 if (category >= 0 && category < m_packetOutboxes.Length) 440 if (category >= 0 && category < m_packetOutboxes.Length)
442 { 441 {
443 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category]; 442 DoubleLocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
444 443
445 if (m_deliverPackets == false) 444 if (m_deliverPackets == false)
446 { 445 {
447 queue.Enqueue(packet); 446 queue.Enqueue(packet, highPriority);
448 return true; 447 return true;
449 } 448 }
450 449
@@ -455,7 +454,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
455 // queued packets 454 // queued packets
456 if (queue.Count > 0) 455 if (queue.Count > 0)
457 { 456 {
458 queue.Enqueue(packet); 457 queue.Enqueue(packet, highPriority);
459 return true; 458 return true;
460 } 459 }
461 460
@@ -468,7 +467,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
468 else 467 else
469 { 468 {
470 // Force queue specified or not enough tokens in the bucket, queue this packet 469 // Force queue specified or not enough tokens in the bucket, queue this packet
471 queue.Enqueue(packet); 470 queue.Enqueue(packet, highPriority);
472 return true; 471 return true;
473 } 472 }
474 } 473 }
@@ -500,7 +499,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
500 if (m_deliverPackets == false) return false; 499 if (m_deliverPackets == false) return false;
501 500
502 OutgoingPacket packet = null; 501 OutgoingPacket packet = null;
503 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue; 502 DoubleLocklessQueue<OutgoingPacket> queue;
504 TokenBucket bucket; 503 TokenBucket bucket;
505 bool packetSent = false; 504 bool packetSent = false;
506 ThrottleOutPacketTypeFlags emptyCategories = 0; 505 ThrottleOutPacketTypeFlags emptyCategories = 0;
@@ -540,7 +539,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
540 } 539 }
541 catch 540 catch
542 { 541 {
543 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>(); 542 m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
544 } 543 }
545 if (success) 544 if (success)
546 { 545 {
@@ -573,7 +572,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
573 } 572 }
574 else 573 else
575 { 574 {
576 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>(); 575 m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
577 emptyCategories |= CategoryToFlag(i); 576 emptyCategories |= CategoryToFlag(i);
578 } 577 }
579 } 578 }
@@ -709,9 +708,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
709 Texture = 5, 708 Texture = 5,
710 /// <summary>Non-texture assets</summary> 709 /// <summary>Non-texture assets</summary>
711 Asset = 6, 710 Asset = 6,
712 /// <summary>Avatar and primitive data</summary>
713 /// <remarks>This is a sub-category of Task</remarks>
714 State = 7,
715 */ 711 */
716 712
717 switch (category) 713 switch (category)
@@ -728,11 +724,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP
728 return ThrottleOutPacketTypeFlags.Texture; 724 return ThrottleOutPacketTypeFlags.Texture;
729 case ThrottleOutPacketType.Asset: 725 case ThrottleOutPacketType.Asset:
730 return ThrottleOutPacketTypeFlags.Asset; 726 return ThrottleOutPacketTypeFlags.Asset;
731 case ThrottleOutPacketType.State:
732 return ThrottleOutPacketTypeFlags.State;
733 default: 727 default:
734 return 0; 728 return 0;
735 } 729 }
736 } 730 }
737 } 731 }
732
733 public class DoubleLocklessQueue<T> : OpenSim.Framework.LocklessQueue<T>
734 {
735 OpenSim.Framework.LocklessQueue<T> highQueue = new OpenSim.Framework.LocklessQueue<T>();
736
737 public override int Count
738 {
739 get
740 {
741 return base.Count + highQueue.Count;
742 }
743 }
744
745 public override bool Dequeue(out T item)
746 {
747 if (highQueue.Dequeue(out item))
748 return true;
749
750 return base.Dequeue(out item);
751 }
752
753 public void Enqueue(T item, bool highPriority)
754 {
755 if (highPriority)
756 highQueue.Enqueue(item);
757 else
758 Enqueue(item);
759 }
760 }
738} 761}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 9a4abd4..6c72edc 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -803,6 +803,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
803 803
804 #region Queue or Send 804 #region Queue or Send
805 805
806 bool highPriority = false;
807
808 if (category != ThrottleOutPacketType.Unknown && (category & ThrottleOutPacketType.HighPriority) != 0)
809 {
810 category = (ThrottleOutPacketType)((int)category & 127);
811 highPriority = true;
812 }
813
806 OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null); 814 OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null);
807 // If we were not provided a method for handling unacked, use the UDPServer default method 815 // If we were not provided a method for handling unacked, use the UDPServer default method
808 outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method); 816 outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method);
@@ -811,7 +819,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
811 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object 819 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object
812 // packet so that it isn't sent before a queued update packet. 820 // packet so that it isn't sent before a queued update packet.
813 bool requestQueue = type == PacketType.KillObject; 821 bool requestQueue = type == PacketType.KillObject;
814 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue)) 822 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority))
815 SendPacketFinal(outgoingPacket); 823 SendPacketFinal(outgoingPacket);
816 824
817 #endregion Queue or Send 825 #endregion Queue or Send