aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs19
1 files changed, 17 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index 7be8a0a..e54d326 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -135,7 +135,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
135 private int m_nextOnQueueEmpty = 1; 135 private int m_nextOnQueueEmpty = 1;
136 136
137 /// <summary>Throttle bucket for this agent's connection</summary> 137 /// <summary>Throttle bucket for this agent's connection</summary>
138 private readonly TokenBucket m_throttleClient; 138 private readonly AdaptiveTokenBucket m_throttleClient;
139 public AdaptiveTokenBucket FlowThrottle
140 {
141 get { return m_throttleClient; }
142 }
143
139 /// <summary>Throttle bucket for this agent's connection</summary> 144 /// <summary>Throttle bucket for this agent's connection</summary>
140 private readonly TokenBucket m_throttleCategory; 145 private readonly TokenBucket m_throttleCategory;
141 /// <summary>Throttle buckets for each packet category</summary> 146 /// <summary>Throttle buckets for each packet category</summary>
@@ -153,6 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
153 158
154 private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC 159 private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC
155 private int m_maxRTO = 60000; 160 private int m_maxRTO = 60000;
161 public bool m_deliverPackets = true;
156 162
157 /// <summary> 163 /// <summary>
158 /// Default constructor 164 /// Default constructor
@@ -176,7 +182,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
176 m_maxRTO = maxRTO; 182 m_maxRTO = maxRTO;
177 183
178 // Create a token bucket throttle for this client that has the scene token bucket as a parent 184 // Create a token bucket throttle for this client that has the scene token bucket as a parent
179 m_throttleClient = new TokenBucket(parentThrottle, rates.TotalLimit); 185 m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.TotalLimit);
180 // Create a token bucket throttle for the total categary with the client bucket as a throttle 186 // Create a token bucket throttle for the total categary with the client bucket as a throttle
181 m_throttleCategory = new TokenBucket(m_throttleClient, rates.TotalLimit); 187 m_throttleCategory = new TokenBucket(m_throttleClient, rates.TotalLimit);
182 // Create an array of token buckets for this clients different throttle categories 188 // Create an array of token buckets for this clients different throttle categories
@@ -438,6 +444,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
438 if (category >= 0 && category < m_packetOutboxes.Length) 444 if (category >= 0 && category < m_packetOutboxes.Length)
439 { 445 {
440 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category]; 446 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
447
448 if (m_deliverPackets == false)
449 {
450 queue.Enqueue(packet);
451 return true;
452 }
453
441 TokenBucket bucket = m_throttleCategories[category]; 454 TokenBucket bucket = m_throttleCategories[category];
442 455
443 // Don't send this packet if there is already a packet waiting in the queue 456 // Don't send this packet if there is already a packet waiting in the queue
@@ -487,6 +500,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
487 /// <returns>True if any packets were sent, otherwise false</returns> 500 /// <returns>True if any packets were sent, otherwise false</returns>
488 public bool DequeueOutgoing() 501 public bool DequeueOutgoing()
489 { 502 {
503 if (m_deliverPackets == false) return false;
504
490 OutgoingPacket packet; 505 OutgoingPacket packet;
491 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue; 506 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue;
492 TokenBucket bucket; 507 TokenBucket bucket;