diff options
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 37 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 32 |
2 files changed, 47 insertions, 22 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index f812ce1..7c8e226 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -260,7 +260,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
260 | // Initialize the packet outboxes, where packets sit while they are waiting for tokens | 260 | // Initialize the packet outboxes, where packets sit while they are waiting for tokens |
261 | m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>(); | 261 | m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>(); |
262 | // Initialize the token buckets that control the throttling for each category | 262 | // Initialize the token buckets that control the throttling for each category |
263 | m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst); | 263 | //m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst); |
264 | float rate = rates.GetRate(type); | ||
265 | float burst = rate * rates.BrustTime; | ||
266 | m_throttleCategories[i] = new TokenBucket(m_throttleClient, rate , burst); | ||
264 | } | 267 | } |
265 | 268 | ||
266 | // Default the retransmission timeout to one second | 269 | // Default the retransmission timeout to one second |
@@ -443,7 +446,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
443 | 446 | ||
444 | int total = resend + land + wind + cloud + task + texture + asset; | 447 | int total = resend + land + wind + cloud + task + texture + asset; |
445 | 448 | ||
446 | float m_burst = total * m_burstTime; | 449 | //float m_burst = total * m_burstTime; |
447 | 450 | ||
448 | if (ThrottleDebugLevel > 0) | 451 | if (ThrottleDebugLevel > 0) |
449 | { | 452 | { |
@@ -453,7 +456,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
453 | } | 456 | } |
454 | 457 | ||
455 | TokenBucket bucket; | 458 | TokenBucket bucket; |
456 | 459 | /* | |
457 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; | 460 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; |
458 | bucket.RequestedDripRate = resend; | 461 | bucket.RequestedDripRate = resend; |
459 | bucket.RequestedBurst = m_burst; | 462 | bucket.RequestedBurst = m_burst; |
@@ -481,6 +484,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
481 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; | 484 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; |
482 | bucket.RequestedDripRate = texture; | 485 | bucket.RequestedDripRate = texture; |
483 | bucket.RequestedBurst = m_burst; | 486 | bucket.RequestedBurst = m_burst; |
487 | */ | ||
488 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; | ||
489 | bucket.RequestedDripRate = resend; | ||
490 | bucket.RequestedBurst = resend * m_burstTime; | ||
491 | |||
492 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Land]; | ||
493 | bucket.RequestedDripRate = land; | ||
494 | bucket.RequestedBurst = land * m_burstTime; | ||
495 | |||
496 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Wind]; | ||
497 | bucket.RequestedDripRate = wind; | ||
498 | bucket.RequestedBurst = wind * m_burstTime; | ||
499 | |||
500 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Cloud]; | ||
501 | bucket.RequestedDripRate = cloud; | ||
502 | bucket.RequestedBurst = cloud * m_burstTime; | ||
503 | |||
504 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Asset]; | ||
505 | bucket.RequestedDripRate = asset; | ||
506 | bucket.RequestedBurst = asset * m_burstTime; | ||
507 | |||
508 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task]; | ||
509 | bucket.RequestedDripRate = task; | ||
510 | bucket.RequestedBurst = task * m_burstTime; | ||
511 | |||
512 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; | ||
513 | bucket.RequestedDripRate = texture; | ||
514 | bucket.RequestedBurst = texture * m_burstTime; | ||
484 | 515 | ||
485 | // Reset the packed throttles cached data | 516 | // Reset the packed throttles cached data |
486 | m_packedThrottles = null; | 517 | m_packedThrottles = null; |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 1daf091..1bf05a3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | |||
@@ -45,22 +45,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
45 | 45 | ||
46 | private static Int32 m_counter = 0; | 46 | private static Int32 m_counter = 0; |
47 | 47 | ||
48 | // private Int32 m_identifier; | ||
49 | |||
50 | protected const float m_timeScale = 1e-3f; | 48 | protected const float m_timeScale = 1e-3f; |
51 | 49 | ||
52 | /// <summary> | 50 | /// <summary> |
53 | /// This is the number of m_minimumDripRate bytes | 51 | /// minimum recovery rate, ie bandwith |
54 | /// allowed in a burst | ||
55 | /// roughtly, with this settings, the maximum time system will take | ||
56 | /// to recheck a bucket in ms | ||
57 | /// | ||
58 | /// </summary> | 52 | /// </summary> |
59 | protected const float m_quantumsPerBurst = 5; | 53 | protected const float MINDRIPRATE = 500; |
60 | 54 | ||
61 | /// <summary> | 55 | // minimum and maximim burst size, ie max number of bytes token can have |
62 | /// </summary> | 56 | protected const float MINBURST = 1500; // can't be less than one MTU or it will block |
63 | protected const float m_minimumDripRate = 1500; | 57 | protected const float MAXBURST = 7500; |
64 | 58 | ||
65 | /// <summary>Time of the last drip</summary> | 59 | /// <summary>Time of the last drip</summary> |
66 | protected double m_lastDrip; | 60 | protected double m_lastDrip; |
@@ -109,10 +103,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
109 | get { return m_burst; } | 103 | get { return m_burst; } |
110 | set { | 104 | set { |
111 | float rate = (value < 0 ? 0 : value); | 105 | float rate = (value < 0 ? 0 : value); |
112 | if (rate < 1.5f * m_minimumDripRate) | 106 | if (rate < MINBURST) |
113 | rate = 1.5f * m_minimumDripRate; | 107 | rate = MINBURST; |
114 | else if (rate > m_minimumDripRate * m_quantumsPerBurst) | 108 | else if (rate > MAXBURST) |
115 | rate = m_minimumDripRate * m_quantumsPerBurst; | 109 | rate = MAXBURST; |
116 | 110 | ||
117 | m_burst = rate; | 111 | m_burst = rate; |
118 | } | 112 | } |
@@ -122,8 +116,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
122 | { | 116 | { |
123 | get { | 117 | get { |
124 | float rate = RequestedBurst * BurstModifier(); | 118 | float rate = RequestedBurst * BurstModifier(); |
125 | if (rate < m_minimumDripRate) | 119 | if (rate < MINBURST) |
126 | rate = m_minimumDripRate; | 120 | rate = MINBURST; |
127 | return (float)rate; | 121 | return (float)rate; |
128 | } | 122 | } |
129 | } | 123 | } |
@@ -159,8 +153,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
159 | return rate; | 153 | return rate; |
160 | 154 | ||
161 | rate *= m_parent.DripRateModifier(); | 155 | rate *= m_parent.DripRateModifier(); |
162 | if (rate < m_minimumDripRate) | 156 | if (rate < MINDRIPRATE) |
163 | rate = m_minimumDripRate; | 157 | rate = MINDRIPRATE; |
164 | 158 | ||
165 | return (float)rate; | 159 | return (float)rate; |
166 | } | 160 | } |