diff options
author | UbitUmarov | 2019-04-16 19:07:26 +0100 |
---|---|---|
committer | UbitUmarov | 2019-04-16 19:07:26 +0100 |
commit | 11cad57c9cac5c17a9d658da7ec2e8c4b5cc75d1 (patch) | |
tree | c619bd9d83fbdddd7022df4290008c427c897550 /OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | |
parent | Yengine: rename a field, do some updates using interlocked (diff) | |
download | opensim-SC-11cad57c9cac5c17a9d658da7ec2e8c4b5cc75d1.zip opensim-SC-11cad57c9cac5c17a9d658da7ec2e8c4b5cc75d1.tar.gz opensim-SC-11cad57c9cac5c17a9d658da7ec2e8c4b5cc75d1.tar.bz2 opensim-SC-11cad57c9cac5c17a9d658da7ec2e8c4b5cc75d1.tar.xz |
lludp: change burst, make it per category (overall reduction)
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 32 |
1 files changed, 13 insertions, 19 deletions
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 | } |