コード例 #1
0
        public void TestClientThrottlePerClientAndRegionLimited()
        {
            TestHelpers.InMethod();
            //TestHelpers.EnableLogging();

            int resendBytes  = 4000;
            int landBytes    = 6000;
            int windBytes    = 8000;
            int cloudBytes   = 10000;
            int taskBytes    = 12000;
            int textureBytes = 14000;
            int assetBytes   = 16000;

            // current total 70000
            int totalBytes = resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes;

            Scene           scene     = new SceneHelpers().SetupScene();
            TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene);

            udpServer.ThrottleRates.Total        = (int)(totalBytes * 1.1);
            udpServer.Throttle.RequestedDripRate = (int)(totalBytes * 1.5);

            ScenePresence sp1
                = ClientStackHelpers.AddChildClient(
                      scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);

            LLUDPClient udpClient1 = ((LLClientView)sp1.ControllingClient).UDPClient;

            udpClient1.ThrottleDebugLevel = 1;

            SetThrottles(
                udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);

            AssertThrottles(
                udpClient1,
                resendBytes, landBytes, windBytes, cloudBytes, taskBytes,
                textureBytes, assetBytes, totalBytes, 0, totalBytes * 1.1);

            // Now add another client
            ScenePresence sp2
                = ClientStackHelpers.AddChildClient(
                      scene, udpServer, TestHelpers.ParseTail(0x10), TestHelpers.ParseTail(0x20), 123457);

            LLUDPClient udpClient2 = ((LLClientView)sp2.ControllingClient).UDPClient;

            udpClient2.ThrottleDebugLevel = 1;

            SetThrottles(
                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,
                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,
                textureBytes * 0.75, assetBytes * 0.75, totalBytes * 0.75, 0, totalBytes * 1.1);
        }
コード例 #2
0
        public void TestSingleClientThrottleRegionLimited()
        {
            TestHelpers.InMethod();
            //            TestHelpers.EnableLogging();

            int resendBytes  = 6000;
            int landBytes    = 8000;
            int windBytes    = 10000;
            int cloudBytes   = 12000;
            int taskBytes    = 14000;
            int textureBytes = 16000;
            int assetBytes   = 18000;
            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
                = ClientStackHelpers.AddChildClient(
                      scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);

            LLUDPClient udpClient1 = ((LLClientView)sp1.ControllingClient).UDPClient;

            SetThrottles(
                udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);

            AssertThrottles(
                udpClient1,
                resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2,
                textureBytes / 2, assetBytes / 2, totalBytes, 0, 0);

            // Test: Now add another client
            ScenePresence sp2
                = ClientStackHelpers.AddChildClient(
                      scene, udpServer, TestHelpers.ParseTail(0x10), TestHelpers.ParseTail(0x20), 123457);

            LLUDPClient udpClient2 = ((LLClientView)sp2.ControllingClient).UDPClient;

            //            udpClient.ThrottleDebugLevel = 1;

            SetThrottles(
                udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);

            AssertThrottles(
                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,
                textureBytes / 4, assetBytes / 4, totalBytes / 2, 0, 0);
        }
コード例 #3
0
        public void TestLogoutClientDueToAck()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            IniConfigSource ics    = new IniConfigSource();
            IConfig         config = ics.AddConfig("ClientStack.LindenUDP");

            config.Set("AckTimeout", -1);
            TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(m_scene, ics);

            ScenePresence sp
                = ClientStackHelpers.AddChildClient(
                      m_scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);

            udpServer.ClientOutgoingPacketHandler(sp.ControllingClient, true, false, false);

            ScenePresence spAfterAckTimeout = m_scene.GetScenePresence(sp.UUID);

            Assert.That(spAfterAckTimeout, Is.Null);
        }
コード例 #4
0
        public void TestClientThrottlePerClientLimited()
        {
            TestHelpers.InMethod();
            //            TestHelpers.EnableLogging();

            int resendBytes  = 4000;
            int landBytes    = 6000;
            int windBytes    = 8000;
            int cloudBytes   = 10000;
            int taskBytes    = 12000;
            int textureBytes = 14000;
            int assetBytes   = 16000;
            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
                = ClientStackHelpers.AddChildClient(
                      scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);

            LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;

            //            udpClient.ThrottleDebugLevel = 1;

            SetThrottles(
                udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);

            AssertThrottles(
                udpClient,
                resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2,
                textureBytes / 2, assetBytes / 2, totalBytes, 0, totalBytes);
        }
コード例 #5
0
        public void TestClientThrottleSetNoLimit()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            Scene           scene     = new SceneHelpers().SetupScene();
            TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene);

            ScenePresence sp
                = ClientStackHelpers.AddChildClient(
                      scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);

            LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;

            udpServer.Throttle.DebugLevel = 1;
            udpClient.ThrottleDebugLevel  = 1;

            int resendBytes  = 1000;
            int landBytes    = 2000;
            int windBytes    = 3000;
            int cloudBytes   = 4000;
            int taskBytes    = 5000;
            int textureBytes = 6000;
            int assetBytes   = 7000;

            SetThrottles(
                udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);

            // We expect this to be lower because of the minimum bound set by MTU
            int totalBytes = LLUDPServer.MTU + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes;

            AssertThrottles(
                udpClient,
                LLUDPServer.MTU, landBytes, windBytes, cloudBytes, taskBytes,
                textureBytes, assetBytes, totalBytes, 0, 0);
        }
コード例 #6
0
        public void TestClientThrottleAdaptiveNoLimit()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            Scene scene = new SceneHelpers().SetupScene();

            IniConfigSource ics    = new IniConfigSource();
            IConfig         config = ics.AddConfig("ClientStack.LindenUDP");

            config.Set("enable_adaptive_throttles", true);
            config.Set("adaptive_throttle_min_bps", 32000);

            TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene, ics);

            ScenePresence sp
                = ClientStackHelpers.AddChildClient(
                      scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);

            LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;

            udpServer.Throttle.DebugLevel = 1;
            udpClient.ThrottleDebugLevel  = 1;

            // Total is 275000
            int resendBytes  = 5000; // this is set low to test the minimum throttle override
            int landBytes    = 20000;
            int windBytes    = 30000;
            int cloudBytes   = 40000;
            int taskBytes    = 50000;
            int textureBytes = 60000;
            int assetBytes   = 70000;
            int totalBytes   = resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes;

            SetThrottles(
                udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);

            // Ratio of current adaptive drip rate to requested bytes, minimum rate is 32000
            double commitRatio = 32000.0 / totalBytes;

            AssertThrottles(
                udpClient,
                LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio,
                textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0);

            // Test an increase in target throttle, ack of 20 packets adds 20 * LLUDPServer.MTU bytes
            // to the throttle, recompute commitratio from those numbers
            udpClient.FlowThrottle.AcknowledgePackets(20);
            commitRatio = (32000.0 + 20.0 * LLUDPServer.MTU) / totalBytes;

            AssertThrottles(
                udpClient,
                LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio,
                textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0);

            // Test a decrease in target throttle, adaptive throttle should cut the rate by 50% with a floor
            // set by the minimum adaptive rate
            udpClient.FlowThrottle.ExpirePackets(1);
            commitRatio = (32000.0 + (20.0 * LLUDPServer.MTU) / Math.Pow(2, 1)) / totalBytes;

            AssertThrottles(
                udpClient,
                LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio,
                textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0);
        }