From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 19 May 2019 21:24:15 +1000 Subject: Dump OpenSim 0.9.0.1 into it's own branch. --- .../Linden/UDP/Tests/BasicCircuitTests.cs | 47 +++++++------- .../Linden/UDP/Tests/PacketHandlerTests.cs | 8 +-- .../ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 75 ++++++++++++---------- 3 files changed, 68 insertions(+), 62 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/Tests') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs index a935dd2..eb262d2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs @@ -70,7 +70,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests m_scene = new SceneHelpers().SetupScene(); StatsManager.SimExtraStats = new SimExtraStatsCollector(); } - + // /// // /// Build an object name packet for test purposes // /// @@ -84,13 +84,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests // odb.Name = Utils.StringToBytes(objectName); // onp.ObjectData = new ObjectNamePacket.ObjectDataBlock[] { odb }; // onp.Header.Zerocoded = false; -// +// // return onp; // } // /// /// Test adding a client to the stack /// +/* [Test] public void TestAddClient() { @@ -156,7 +157,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests config.Set("AckTimeout", -1); TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(m_scene, ics); - ScenePresence sp + ScenePresence sp = ClientStackHelpers.AddChildClient( m_scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); @@ -165,7 +166,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests ScenePresence spAfterAckTimeout = m_scene.GetScenePresence(sp.UUID); Assert.That(spAfterAckTimeout, Is.Null); } - +*/ // /// // /// Test removing a client from the stack // /// @@ -175,21 +176,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests // TestHelper.InMethod(); // // uint myCircuitCode = 123457; -// +// // TestLLUDPServer testLLUDPServer; // TestLLPacketServer testLLPacketServer; // AgentCircuitManager acm; // SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm); // AddClient(myCircuitCode, new IPEndPoint(IPAddress.Loopback, 1000), testLLUDPServer, acm); -// +// // testLLUDPServer.RemoveClientCircuit(myCircuitCode); // Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode)); -// +// // // Check that removing a non-existent circuit doesn't have any bad effects // testLLUDPServer.RemoveClientCircuit(101); // Assert.IsFalse(testLLUDPServer.HasCircuit(101)); // } -// +// // /// // /// Make sure that the client stack reacts okay to malformed packets // /// @@ -200,8 +201,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests // // uint myCircuitCode = 123458; // EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 1001); -// MockScene scene = new MockScene(); -// +// MockScene scene = new MockScene(); +// // TestLLUDPServer testLLUDPServer; // TestLLPacketServer testLLPacketServer; // AgentCircuitManager acm; @@ -213,24 +214,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests // // Send two garbled 'packets' in succession // testLLUDPServer.LoadReceive(data, testEp); // testLLUDPServer.LoadReceive(data, testEp); -// testLLUDPServer.ReceiveData(null); -// +// testLLUDPServer.ReceiveData(null); +// // // Check that we are still here // Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode)); // Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(0)); -// +// // // Check that sending a valid packet to same circuit still succeeds // Assert.That(scene.ObjectNameCallsReceived, Is.EqualTo(0)); -// +// // testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "helloooo"), testEp); // testLLUDPServer.ReceiveData(null); -// +// // Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(1)); // Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(1)); // } -// +// // /// -// /// Test that the stack continues to work even if some client has caused a +// /// Test that the stack continues to work even if some client has caused a // /// SocketException on Socket.BeginReceive() // /// // [Test] @@ -239,32 +240,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests // TestHelper.InMethod(); // // MockScene scene = new MockScene(); -// +// // uint circuitCodeA = 130000; // EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300); // UUID agentIdA = UUID.Parse("00000000-0000-0000-0000-000000001300"); // UUID sessionIdA = UUID.Parse("00000000-0000-0000-0000-000000002300"); -// +// // uint circuitCodeB = 130001; // EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301); // UUID agentIdB = UUID.Parse("00000000-0000-0000-0000-000000001301"); // UUID sessionIdB = UUID.Parse("00000000-0000-0000-0000-000000002301"); -// +// // TestLLUDPServer testLLUDPServer; // TestLLPacketServer testLLPacketServer; // AgentCircuitManager acm; // SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm); // AddClient(circuitCodeA, epA, agentIdA, sessionIdA, testLLUDPServer, acm); // AddClient(circuitCodeB, epB, agentIdB, sessionIdB, testLLUDPServer, acm); -// +// // testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet1"), epA); // testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "packet2"), epB); // testLLUDPServer.LoadReceiveWithBeginException(epA); // testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(2, "packet3"), epB); // testLLUDPServer.ReceiveData(null); -// +// // Assert.IsFalse(testLLUDPServer.HasCircuit(circuitCodeA)); -// +// // Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(3)); // Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(3)); // } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs index 92f1fc3..1731aa9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests // agent.InventoryFolder = UUID.Zero; // agent.startpos = Vector3.Zero; // agent.CapsPath = "http://wibble.com"; -// +// // TestLLUDPServer testLLUDPServer; // TestLLPacketServer testLLPacketServer; // AgentCircuitManager acm; @@ -67,7 +67,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests // SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm); // // TestClient testClient = new TestClient(agent, scene); -// +// // LLPacketHandler packetHandler // = new LLPacketHandler(testClient, testLLPacketServer, new ClientStackUserSettings()); // @@ -87,14 +87,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests // /// // /// Agent circuit manager used in setting up the stack // protected void SetupStack( -// IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer, +// IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer, // out AgentCircuitManager acm) // { // IConfigSource configSource = new IniConfigSource(); // ClientStackUserSettings userSettings = new ClientStackUserSettings(); // testLLUDPServer = new TestLLUDPServer(); // acm = new AgentCircuitManager(); -// +// // uint port = 666; // testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm); // testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 3c82a78..873b1e5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs @@ -35,6 +35,7 @@ using OpenSim.Tests.Common; namespace OpenSim.Region.ClientStack.LindenUDP.Tests { + /* [TestFixture] public class ThrottleTests : OpenSimTestCase { @@ -57,16 +58,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests [Test] public void TestSetRequestDripRate() { + TestHelpers.InMethod(); - TokenBucket tb = new TokenBucket("tb", null, 5000, 0); + TokenBucket tb = new TokenBucket(null, 5000f,10000f); AssertRates(tb, 5000, 0, 5000, 0); - tb.RequestedDripRate = 4000; + tb.RequestedDripRate = 4000f; AssertRates(tb, 4000, 0, 4000, 0); tb.RequestedDripRate = 6000; AssertRates(tb, 6000, 0, 6000, 0); + } [Test] @@ -74,7 +77,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests { TestHelpers.InMethod(); - TokenBucket tb = new TokenBucket("tb", null, 5000, 10000); + TokenBucket tb = new TokenBucket(null, 5000,15000); AssertRates(tb, 5000, 0, 5000, 10000); tb.RequestedDripRate = 4000; @@ -92,9 +95,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests { TestHelpers.InMethod(); - TokenBucket tbParent = new TokenBucket("tbParent", null, 0, 0); - TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000, 0); - TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000, 0); + TokenBucket tbParent = new TokenBucket("tbParent", null, 0); + TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000); + TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000); AssertRates(tbParent, 8000, 8000, 8000, 0); AssertRates(tbChild1, 3000, 0, 3000, 0); @@ -113,6 +116,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests AssertRates(tbParent, 6000, 8000, 6000, 0); AssertRates(tbChild1, 3000, 0, 6000 / 8 * 3, 0); AssertRates(tbChild2, 5000, 0, 6000 / 8 * 5, 0); + } private void AssertRates( @@ -133,7 +137,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests Scene scene = new SceneHelpers().SetupScene(); TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene); - ScenePresence sp + ScenePresence sp = ClientStackHelpers.AddChildClient( scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); @@ -141,7 +145,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpServer.Throttle.DebugLevel = 1; udpClient.ThrottleDebugLevel = 1; - + int resendBytes = 1000; int landBytes = 2000; int windBytes = 3000; @@ -157,8 +161,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests int totalBytes = LLUDPServer.MTU + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes; AssertThrottles( - udpClient, - LLUDPServer.MTU, landBytes, windBytes, cloudBytes, taskBytes, + udpClient, + LLUDPServer.MTU, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes, totalBytes, 0, 0); } @@ -177,7 +181,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene, ics); - ScenePresence sp + ScenePresence sp = ClientStackHelpers.AddChildClient( scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); @@ -203,7 +207,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests double commitRatio = 32000.0 / totalBytes; AssertThrottles( - udpClient, + udpClient, LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); @@ -213,7 +217,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests commitRatio = (32000.0 + 20.0 * LLUDPServer.MTU) / totalBytes; AssertThrottles( - udpClient, + udpClient, LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); @@ -223,7 +227,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests commitRatio = (32000.0 + (20.0 * LLUDPServer.MTU)/Math.Pow(2,1)) / totalBytes; AssertThrottles( - udpClient, + udpClient, LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); } @@ -244,14 +248,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests int taskBytes = 14000; int textureBytes = 16000; int assetBytes = 18000; - int totalBytes + int totalBytes = (int)((resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes) / 2); Scene scene = new SceneHelpers().SetupScene(); TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene); udpServer.Throttle.RequestedDripRate = totalBytes; - ScenePresence sp1 + ScenePresence sp1 = ClientStackHelpers.AddChildClient( scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); @@ -261,8 +265,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); AssertThrottles( - udpClient1, - resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2, + udpClient1, + resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2, textureBytes / 2, assetBytes / 2, totalBytes, 0, 0); // Test: Now add another client @@ -277,13 +281,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); AssertThrottles( - udpClient1, - resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4, + udpClient1, + resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4, textureBytes / 4, assetBytes / 4, totalBytes / 2, 0, 0); AssertThrottles( - udpClient2, - resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4, + udpClient2, + resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4, textureBytes / 4, assetBytes / 4, totalBytes / 2, 0, 0); } @@ -303,14 +307,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests int taskBytes = 12000; int textureBytes = 14000; int assetBytes = 16000; - int totalBytes + int totalBytes = (int)((resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes) / 2); Scene scene = new SceneHelpers().SetupScene(); TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene); udpServer.ThrottleRates.Total = totalBytes; - ScenePresence sp + ScenePresence sp = ClientStackHelpers.AddChildClient( scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); @@ -321,8 +325,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); AssertThrottles( - udpClient, - resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2, + udpClient, + resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2, textureBytes / 2, assetBytes / 2, totalBytes, 0, totalBytes); } @@ -348,7 +352,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpServer.ThrottleRates.Total = (int)(totalBytes * 1.1); udpServer.Throttle.RequestedDripRate = (int)(totalBytes * 1.5); - ScenePresence sp1 + ScenePresence sp1 = ClientStackHelpers.AddChildClient( scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456); @@ -359,8 +363,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); AssertThrottles( - udpClient1, - resendBytes, landBytes, windBytes, cloudBytes, taskBytes, + udpClient1, + resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes, totalBytes, 0, totalBytes * 1.1); // Now add another client @@ -375,25 +379,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); AssertThrottles( - udpClient1, - resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75, + udpClient1, + resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75, textureBytes * 0.75, assetBytes * 0.75, totalBytes * 0.75, 0, totalBytes * 1.1); AssertThrottles( - udpClient2, - resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75, + udpClient2, + resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75, textureBytes * 0.75, assetBytes * 0.75, totalBytes * 0.75, 0, totalBytes * 1.1); } private void AssertThrottles( - LLUDPClient udpClient, + LLUDPClient udpClient, double resendBytes, double landBytes, double windBytes, double cloudBytes, double taskBytes, double textureBytes, double assetBytes, double totalBytes, double targetBytes, double maxBytes) { ClientInfo ci = udpClient.GetClientInfo(); // Console.WriteLine( -// "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", +// "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}", // ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle); Assert.AreEqual((int)resendBytes, ci.resendThrottle, "Resend"); @@ -424,4 +428,5 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpClient.SetThrottles(throttles); } } + */ } \ No newline at end of file -- cgit v1.1