From d1810866b3177c9c6026f619426c1bda72e14374 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Jul 2016 19:53:41 +0100 Subject: simplify http textures and meshs Throttles --- .../ClientStack/Linden/Caps/GetTextureModule.cs | 30 +++++++--------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 0c4e227..14a59fe 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -356,7 +356,9 @@ namespace OpenSim.Region.ClientStack.Linden internal void UpdateThrottle(int pimagethrottle) { - m_throttler.ThrottleBytes = pimagethrottle; + m_throttler.ThrottleBytes = 2 * pimagethrottle; + if(m_throttler.ThrottleBytes < 10000) + m_throttler.ThrottleBytes = 10000; } } @@ -425,10 +427,11 @@ namespace OpenSim.Region.ClientStack.Linden private volatile int currenttime = 0; private volatile int lastTimeElapsed = 0; private volatile int BytesSent = 0; - private int oversizedImages = 0; public CapsDataThrottler(int pBytes, int max, int min) { ThrottleBytes = pBytes; + if(ThrottleBytes < 10000) + ThrottleBytes = 10000; lastTimeElapsed = Util.EnvironmentTickCount(); } public bool hasEvents(UUID key, Dictionary responses) @@ -448,20 +451,9 @@ namespace OpenSim.Region.ClientStack.Linden return true; // Normal - if (BytesSent + response.bytes <= ThrottleBytes) + if (BytesSent <= ThrottleBytes) { BytesSent += response.bytes; - //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + 1000, unlockyn = false }; - //m_actions.Add(timeBasedAction); - return true; - } - // Big textures - else if (response.bytes > ThrottleBytes && oversizedImages <= ((ThrottleBytes % 50000) + 1)) - { - Interlocked.Increment(ref oversizedImages); - BytesSent += response.bytes; - //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + (((response.bytes % ThrottleBytes)+1)*1000) , unlockyn = false }; - //m_actions.Add(timeBasedAction); return true; } else @@ -483,15 +475,11 @@ namespace OpenSim.Region.ClientStack.Linden currenttime = Util.EnvironmentTickCount(); int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); //processTimeBasedActions(responses); - if (Util.EnvironmentTickCountSubtract(currenttime, timeElapsed) >= 1000) + if (timeElapsed >= 100) { - lastTimeElapsed = Util.EnvironmentTickCount(); - BytesSent -= ThrottleBytes; + lastTimeElapsed = currenttime; + BytesSent -= (ThrottleBytes * timeElapsed / 1000); if (BytesSent < 0) BytesSent = 0; - if (BytesSent < ThrottleBytes) - { - oversizedImages = 0; - } } } public int ThrottleBytes; -- cgit v1.1