aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2018-10-08 18:53:30 +0100
committerUbitUmarov2018-10-08 18:53:30 +0100
commit235dd37b9c6e158ad201d49a2414ce84648bcb86 (patch)
treef19c29d1c85fdc2c0bc67cfce0721d0c552bbd02
parentchange caps get mesh and texture throttle (diff)
downloadopensim-SC-235dd37b9c6e158ad201d49a2414ce84648bcb86.zip
opensim-SC-235dd37b9c6e158ad201d49a2414ce84648bcb86.tar.gz
opensim-SC-235dd37b9c6e158ad201d49a2414ce84648bcb86.tar.bz2
opensim-SC-235dd37b9c6e158ad201d49a2414ce84648bcb86.tar.xz
better have a lock
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs42
1 files changed, 23 insertions, 19 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index bcae69f..3312ace 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -6856,33 +6856,37 @@ namespace OpenSim.Region.Framework.Scenes
6856 private int m_bandwidthBurst = 20000; 6856 private int m_bandwidthBurst = 20000;
6857 private int m_bytesControl; 6857 private int m_bytesControl;
6858 private double m_lastBandwithTime; 6858 private double m_lastBandwithTime;
6859 private object m_throttleLock = new object();
6859 6860
6860 public bool CapCanSendAsset(int type, int size) 6861 public bool CapCanSendAsset(int type, int size)
6861 { 6862 {
6862 if(size == 0) 6863 if(size == 0)
6863 return true; 6864 return true;
6864 6865
6865 if(type > 1) 6866 lock (m_throttleLock)
6866 { 6867 {
6867 // not texture or mesh 6868 if (type > 1)
6868 m_bytesControl -= size; 6869 {
6869 return true; 6870 // not texture or mesh
6870 } 6871 m_bytesControl -= size;
6872 return true;
6873 }
6871 6874
6872 double currenttime = Util.GetTimeStamp(); 6875 double currenttime = Util.GetTimeStamp();
6873 double timeElapsed = currenttime - m_lastBandwithTime; 6876 double timeElapsed = currenttime - m_lastBandwithTime;
6874 if (timeElapsed > .05) 6877 if (timeElapsed > .02)
6875 { 6878 {
6876 m_lastBandwithTime = currenttime; 6879 m_lastBandwithTime = currenttime;
6877 int add = (int)(m_bandwidth * timeElapsed); 6880 int add = (int)(m_bandwidth * timeElapsed);
6878 m_bytesControl += add; 6881 m_bytesControl += add;
6879 if (m_bytesControl > m_bandwidthBurst) 6882 if (m_bytesControl > m_bandwidthBurst)
6880 m_bytesControl = m_bandwidthBurst; 6883 m_bytesControl = m_bandwidthBurst;
6881 } 6884 }
6882 if (m_bytesControl > 0 ) 6885 if (m_bytesControl > 0 )
6883 { 6886 {
6884 m_bytesControl -= size; 6887 m_bytesControl -= size;
6885 return true; 6888 return true;
6889 }
6886 } 6890 }
6887 return false; 6891 return false;
6888 } 6892 }