From 79ec9d28877b2e69058b105a5ef3a82aaa98e59f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 19 Apr 2018 19:08:28 +0100 Subject: [PATCH] use seconds version of gettimestamp --- .../ClientStack/Linden/Caps/GetMeshModule.cs | 29 +++++-------------- .../Linden/Caps/GetTextureModule.cs | 27 ++++------------- 2 files changed, 14 insertions(+), 42 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 5be75fac22..8a5fb85a65 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -244,9 +244,7 @@ namespace OpenSim.Region.ClientStack.Linden { lock (responses) { - bool ret = m_throttler.hasEvents(x, responses); - return ret; - + return m_throttler.hasEvents(x, responses); } }; @@ -434,43 +432,32 @@ namespace OpenSim.Region.ClientStack.Linden if(pBytes < 10000) pBytes = 10000; ThrottleBytes = pBytes; - lastTimeElapsed = Util.GetTimeStampMS(); + lastTimeElapsed = Util.GetTimeStamp(); } public bool hasEvents(UUID key, Dictionary responses) { PassTime(); - // Note, this is called IN LOCK - bool haskey = responses.ContainsKey(key); - - if (!haskey) - { - return false; - } - APollResponse response; + APollResponse response; if (responses.TryGetValue(key, out response)) { // Normal - if (BytesSent <= ThrottleBytes) + if (response.bytes == 0 || BytesSent <= ThrottleBytes) { BytesSent += response.bytes; return true; } - else - { - return false; - } } - return haskey; + return false; } public void PassTime() { - double currenttime = Util.GetTimeStampMS(); + double currenttime = Util.GetTimeStamp(); double timeElapsed = currenttime - lastTimeElapsed; - if(timeElapsed < 50.0) + if(timeElapsed < .05) return; - int add = (int)(ThrottleBytes * timeElapsed * 0.001); + int add = (int)(ThrottleBytes * timeElapsed); if (add >= 1000) { lastTimeElapsed = currenttime; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index b2067395fc..974f9a413b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -450,46 +450,31 @@ namespace OpenSim.Region.ClientStack.Linden if(pBytes < 10000) pBytes = 10000; ThrottleBytes = pBytes; - lastTimeElapsed = Util.GetTimeStampMS(); + lastTimeElapsed = Util.GetTimeStamp(); } public bool hasEvents(UUID key, Dictionary responses) { PassTime(); // Note, this is called IN LOCK - bool haskey = responses.ContainsKey(key); - if (!haskey) - { - return false; - } GetTextureModule.APollResponse response; if (responses.TryGetValue(key, out response)) { - // This is any error response - if (response.bytes == 0) - return true; - - // Normal - if (BytesSent <= ThrottleBytes) + if (response.bytes == 0 || BytesSent <= ThrottleBytes) { BytesSent += response.bytes; return true; } - else - { - return false; - } } - - return haskey; + return false; } public void PassTime() { - double currenttime = Util.GetTimeStampMS(); + double currenttime = Util.GetTimeStamp(); double timeElapsed = currenttime - lastTimeElapsed; - if(timeElapsed < 50.0) + if(timeElapsed < .05) return; - int add = (int)(ThrottleBytes * timeElapsed * 0.001); + int add = (int)(ThrottleBytes * timeElapsed); if (add >= 1000) { lastTimeElapsed = currenttime;