aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs28
1 files changed, 15 insertions, 13 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
index 0560b9b..3c82a78 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
@@ -141,7 +141,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
141 141
142 udpServer.Throttle.DebugLevel = 1; 142 udpServer.Throttle.DebugLevel = 1;
143 udpClient.ThrottleDebugLevel = 1; 143 udpClient.ThrottleDebugLevel = 1;
144 144
145 int resendBytes = 1000; 145 int resendBytes = 1000;
146 int landBytes = 2000; 146 int landBytes = 2000;
147 int windBytes = 3000; 147 int windBytes = 3000;
@@ -173,6 +173,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
173 IniConfigSource ics = new IniConfigSource(); 173 IniConfigSource ics = new IniConfigSource();
174 IConfig config = ics.AddConfig("ClientStack.LindenUDP"); 174 IConfig config = ics.AddConfig("ClientStack.LindenUDP");
175 config.Set("enable_adaptive_throttles", true); 175 config.Set("enable_adaptive_throttles", true);
176 config.Set("adaptive_throttle_min_bps", 32000);
177
176 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene, ics); 178 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene, ics);
177 179
178 ScenePresence sp 180 ScenePresence sp
@@ -184,8 +186,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
184 udpServer.Throttle.DebugLevel = 1; 186 udpServer.Throttle.DebugLevel = 1;
185 udpClient.ThrottleDebugLevel = 1; 187 udpClient.ThrottleDebugLevel = 1;
186 188
187 // Total is 280000 189 // Total is 275000
188 int resendBytes = 10000; 190 int resendBytes = 5000; // this is set low to test the minimum throttle override
189 int landBytes = 20000; 191 int landBytes = 20000;
190 int windBytes = 30000; 192 int windBytes = 30000;
191 int cloudBytes = 40000; 193 int cloudBytes = 40000;
@@ -197,28 +199,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
197 SetThrottles( 199 SetThrottles(
198 udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); 200 udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
199 201
200 // Ratio of current adaptive drip rate to requested bytes 202 // Ratio of current adaptive drip rate to requested bytes, minimum rate is 32000
201 // XXX: Should hard code this as below so we don't rely on values given by tested code to construct 203 double commitRatio = 32000.0 / totalBytes;
202 // expected values.
203 double commitRatio = (double)udpClient.FlowThrottle.AdjustedDripRate / udpClient.FlowThrottle.TargetDripRate;
204 204
205 AssertThrottles( 205 AssertThrottles(
206 udpClient, 206 udpClient,
207 LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, 207 LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio,
208 textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); 208 textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0);
209 209
210 // Test an increase in target throttle 210 // Test an increase in target throttle, ack of 20 packets adds 20 * LLUDPServer.MTU bytes
211 udpClient.FlowThrottle.AcknowledgePackets(35000); 211 // to the throttle, recompute commitratio from those numbers
212 commitRatio = 0.2; 212 udpClient.FlowThrottle.AcknowledgePackets(20);
213 commitRatio = (32000.0 + 20.0 * LLUDPServer.MTU) / totalBytes;
213 214
214 AssertThrottles( 215 AssertThrottles(
215 udpClient, 216 udpClient,
216 resendBytes * commitRatio, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, 217 LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio,
217 textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); 218 textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0);
218 219
219 // Test a decrease in target throttle 220 // Test a decrease in target throttle, adaptive throttle should cut the rate by 50% with a floor
221 // set by the minimum adaptive rate
220 udpClient.FlowThrottle.ExpirePackets(1); 222 udpClient.FlowThrottle.ExpirePackets(1);
221 commitRatio = 0.1; 223 commitRatio = (32000.0 + (20.0 * LLUDPServer.MTU)/Math.Pow(2,1)) / totalBytes;
222 224
223 AssertThrottles( 225 AssertThrottles(
224 udpClient, 226 udpClient,