diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index f812ce13a2..7c8e226672 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 // Initialize the packet outboxes, where packets sit while they are waiting for tokens m_packetOutboxes[i] = new DoubleLocklessQueue(); // Initialize the token buckets that control the throttling for each category - m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst); + //m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst); + float rate = rates.GetRate(type); + float burst = rate * rates.BrustTime; + m_throttleCategories[i] = new TokenBucket(m_throttleClient, rate , burst); } // Default the retransmission timeout to one second @@ -443,7 +446,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP int total = resend + land + wind + cloud + task + texture + asset; - float m_burst = total * m_burstTime; + //float m_burst = total * m_burstTime; if (ThrottleDebugLevel > 0) { @@ -453,7 +456,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } TokenBucket bucket; - + /* bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; bucket.RequestedDripRate = resend; bucket.RequestedBurst = m_burst; @@ -481,6 +484,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; bucket.RequestedDripRate = texture; bucket.RequestedBurst = m_burst; + */ + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; + bucket.RequestedDripRate = resend; + bucket.RequestedBurst = resend * m_burstTime; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Land]; + bucket.RequestedDripRate = land; + bucket.RequestedBurst = land * m_burstTime; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Wind]; + bucket.RequestedDripRate = wind; + bucket.RequestedBurst = wind * m_burstTime; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Cloud]; + bucket.RequestedDripRate = cloud; + bucket.RequestedBurst = cloud * m_burstTime; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Asset]; + bucket.RequestedDripRate = asset; + bucket.RequestedBurst = asset * m_burstTime; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task]; + bucket.RequestedDripRate = task; + bucket.RequestedBurst = task * m_burstTime; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; + bucket.RequestedDripRate = texture; + bucket.RequestedBurst = texture * m_burstTime; // Reset the packed throttles cached data m_packedThrottles = null; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 1daf091521..1bf05a3256 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 private static Int32 m_counter = 0; -// private Int32 m_identifier; - protected const float m_timeScale = 1e-3f; /// - /// This is the number of m_minimumDripRate bytes - /// allowed in a burst - /// roughtly, with this settings, the maximum time system will take - /// to recheck a bucket in ms - /// + /// minimum recovery rate, ie bandwith /// - protected const float m_quantumsPerBurst = 5; + protected const float MINDRIPRATE = 500; - /// - /// - protected const float m_minimumDripRate = 1500; + // minimum and maximim burst size, ie max number of bytes token can have + protected const float MINBURST = 1500; // can't be less than one MTU or it will block + protected const float MAXBURST = 7500; /// Time of the last drip protected double m_lastDrip; @@ -109,10 +103,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_burst; } set { float rate = (value < 0 ? 0 : value); - if (rate < 1.5f * m_minimumDripRate) - rate = 1.5f * m_minimumDripRate; - else if (rate > m_minimumDripRate * m_quantumsPerBurst) - rate = m_minimumDripRate * m_quantumsPerBurst; + if (rate < MINBURST) + rate = MINBURST; + else if (rate > MAXBURST) + rate = MAXBURST; m_burst = rate; } @@ -122,8 +116,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { get { float rate = RequestedBurst * BurstModifier(); - if (rate < m_minimumDripRate) - rate = m_minimumDripRate; + if (rate < MINBURST) + rate = MINBURST; return (float)rate; } } @@ -159,8 +153,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP return rate; rate *= m_parent.DripRateModifier(); - if (rate < m_minimumDripRate) - rate = m_minimumDripRate; + if (rate < MINDRIPRATE) + rate = MINDRIPRATE; return (float)rate; }