diff options
author | Justin Clark-Casey (justincc) | 2014-10-08 21:30:52 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-11-25 23:21:37 +0000 |
commit | 9cdd38d0cfff43219351226ea79c1a1d746b3f27 (patch) | |
tree | 049ddd0a582cf4b67645b99a7d2bc6c80eee5298 /OpenSim/Region/ClientStack/Linden/UDP/Tests | |
parent | refactor: consistently put all test classes in the OpenSim.Tests.Common packa... (diff) | |
download | opensim-SC-9cdd38d0cfff43219351226ea79c1a1d746b3f27.zip opensim-SC-9cdd38d0cfff43219351226ea79c1a1d746b3f27.tar.gz opensim-SC-9cdd38d0cfff43219351226ea79c1a1d746b3f27.tar.bz2 opensim-SC-9cdd38d0cfff43219351226ea79c1a1d746b3f27.tar.xz |
Add regression test TestClientThrottleLimited() for throttle behaviour when a max client total limit is enforced server-side
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/Tests')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 31ea328..d7cbaba 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | |||
@@ -102,5 +102,63 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
102 | Assert.AreEqual(assetBits / 8, ci.assetThrottle); | 102 | Assert.AreEqual(assetBits / 8, ci.assetThrottle); |
103 | Assert.AreEqual(totalBits / 8, ci.totalThrottle); | 103 | Assert.AreEqual(totalBits / 8, ci.totalThrottle); |
104 | } | 104 | } |
105 | |||
106 | /// <summary> | ||
107 | /// Test throttle setttings where max client throttle has been limited server side. | ||
108 | /// </summary> | ||
109 | [Test] | ||
110 | public void TestClientThrottleLimited() | ||
111 | { | ||
112 | TestHelpers.InMethod(); | ||
113 | // TestHelpers.EnableLogging(); | ||
114 | |||
115 | float resendBytes = 4000; | ||
116 | float landBytes = 6000; | ||
117 | float windBytes = 8000; | ||
118 | float cloudBytes = 10000; | ||
119 | float taskBytes = 12000; | ||
120 | float textureBytes = 14000; | ||
121 | float assetBytes = 16000; | ||
122 | int totalBytes | ||
123 | = (int)((resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes) / 2); | ||
124 | |||
125 | Scene scene = new SceneHelpers().SetupScene(); | ||
126 | TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene); | ||
127 | udpServer.ThrottleRates.Total = totalBytes; | ||
128 | |||
129 | ScenePresence sp | ||
130 | = ClientStackHelpers.AddChildClient( | ||
131 | scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); | ||
132 | |||
133 | LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient; | ||
134 | // udpClient.ThrottleDebugLevel = 1; | ||
135 | |||
136 | byte[] throttles = new byte[28]; | ||
137 | |||
138 | Array.Copy(BitConverter.GetBytes(resendBytes * 8), 0, throttles, 0, 4); | ||
139 | Array.Copy(BitConverter.GetBytes(landBytes * 8), 0, throttles, 4, 4); | ||
140 | Array.Copy(BitConverter.GetBytes(windBytes * 8), 0, throttles, 8, 4); | ||
141 | Array.Copy(BitConverter.GetBytes(cloudBytes * 8), 0, throttles, 12, 4); | ||
142 | Array.Copy(BitConverter.GetBytes(taskBytes * 8), 0, throttles, 16, 4); | ||
143 | Array.Copy(BitConverter.GetBytes(textureBytes * 8), 0, throttles, 20, 4); | ||
144 | Array.Copy(BitConverter.GetBytes(assetBytes * 8), 0, throttles, 24, 4); | ||
145 | |||
146 | udpClient.SetThrottles(throttles); | ||
147 | ClientInfo ci = udpClient.GetClientInfo(); | ||
148 | |||
149 | // Console.WriteLine( | ||
150 | // "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", | ||
151 | // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); | ||
152 | |||
153 | // We expect this to be lower because of the minimum bound set by MTU | ||
154 | Assert.AreEqual(resendBytes / 2, ci.resendThrottle); | ||
155 | Assert.AreEqual(landBytes / 2, ci.landThrottle); | ||
156 | Assert.AreEqual(windBytes / 2, ci.windThrottle); | ||
157 | Assert.AreEqual(cloudBytes / 2, ci.cloudThrottle); | ||
158 | Assert.AreEqual(taskBytes / 2, ci.taskThrottle); | ||
159 | Assert.AreEqual(textureBytes / 2, ci.textureThrottle); | ||
160 | Assert.AreEqual(assetBytes / 2, ci.assetThrottle); | ||
161 | Assert.AreEqual(totalBytes, ci.totalThrottle); | ||
162 | } | ||
105 | } | 163 | } |
106 | } \ No newline at end of file | 164 | } \ No newline at end of file |