From bda8f2a2c1d702adc9e61869195a4dbcd3c6751f Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 29 Dec 2014 23:19:10 -0800 Subject: [PATCH] Change the effect of successfully acknowledged packets to bump the adaptive throttle by a full MTU. This is consistent with some implementations of congestion control algorithms and certainly has the effect of opening the throttle window more quickly after errors. This is especially important after initial scene load when the number and size of packets is small. --- .../Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 4 ++-- OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 8 ++++---- .../ClientStack/Linden/UDP/UnackedPacketCollection.cs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 0560b9bc32..17e1af6156 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 udpServer.Throttle.DebugLevel = 1; udpClient.ThrottleDebugLevel = 1; - + int resendBytes = 1000; int landBytes = 2000; int windBytes = 3000; @@ -208,7 +208,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); // Test an increase in target throttle - udpClient.FlowThrottle.AcknowledgePackets(35000); + udpClient.FlowThrottle.AcknowledgePackets(25); commitRatio = 0.2; AssertThrottles( diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index c0cdff6d90..e67c0f5bb8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// - protected const Int32 m_minimumDripRate = 1400; + protected const Int32 m_minimumDripRate = LLUDPServer.MTU; /// Time of the last drip, in system ticks protected Int32 m_lastDrip; @@ -447,12 +447,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// Reliable packets acked by the client adjust the drip rate up. - /// Number of bytes acknowledged + /// Number of packets successfully acknowledged /// - public void AcknowledgePackets(Int32 bytes) + public void AcknowledgePackets(Int32 packets) { if (AdaptiveEnabled) - AdjustedDripRate = AdjustedDripRate + bytes; + AdjustedDripRate = AdjustedDripRate + packets * LLUDPServer.MTU; } } } \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs index 9d6c09e612..adf019f104 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs @@ -192,7 +192,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // As with other network applications, assume that an acknowledged packet is an // indication that the network can handle a little more load, speed up the transmission - ackedPacket.Client.FlowThrottle.AcknowledgePackets(ackedPacket.Buffer.DataLength); + ackedPacket.Client.FlowThrottle.AcknowledgePackets(1); // Update stats Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);