aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs60
1 files changed, 58 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index ed4cafa..bcae69f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1118,6 +1118,20 @@ namespace OpenSim.Region.Framework.Scenes
1118 m_LandingPointBehavior = LandingPointBehavior.SL; 1118 m_LandingPointBehavior = LandingPointBehavior.SL;
1119 } 1119 }
1120 1120
1121 m_bandwidth = 100000;
1122 m_lastBandwithTime = Util.GetTimeStamp() + 0.1;
1123 IConfig cconfig = m_scene.Config.Configs["ClientStack.LindenCaps"];
1124 if (cconfig != null)
1125 {
1126 m_capbandwidth = cconfig.GetInt("Cap_AssetThrottle", m_capbandwidth);
1127 if(m_capbandwidth > 0)
1128 {
1129 m_bandwidth = m_capbandwidth;
1130 if(m_bandwidth < 50000)
1131 m_bandwidth = 50000;
1132 }
1133 }
1134 m_bandwidthBurst = m_bandwidth / 5;
1121 ControllingClient.RefreshGroupMembership(); 1135 ControllingClient.RefreshGroupMembership();
1122 1136
1123 } 1137 }
@@ -4626,7 +4640,12 @@ namespace OpenSim.Region.Framework.Scenes
4626 4640
4627 private void RaiseUpdateThrottles() 4641 private void RaiseUpdateThrottles()
4628 { 4642 {
4629 m_scene.EventManager.TriggerThrottleUpdate(this); 4643 if(m_capbandwidth > 0)
4644 return;
4645 m_bandwidth = 4 * ControllingClient.GetAgentThrottleSilent((int)ThrottleOutPacketType.Texture);
4646 if(m_bandwidth < 50000)
4647 m_bandwidth = 50000;
4648 m_bandwidthBurst = m_bandwidth / 5;
4630 } 4649 }
4631 4650
4632 /// <summary> 4651 /// <summary>
@@ -5834,7 +5853,7 @@ namespace OpenSim.Region.Framework.Scenes
5834 { 5853 {
5835 if (scriptedcontrols.TryGetValue(Script_item_UUID, out takecontrols)) 5854 if (scriptedcontrols.TryGetValue(Script_item_UUID, out takecontrols))
5836 { 5855 {
5837 ScriptControlled sctc = takecontrols.eventControls; 5856 ScriptControlled sctc = takecontrols.eventControls;
5838 5857
5839 ControllingClient.SendTakeControls((int)sctc, false, false); 5858 ControllingClient.SendTakeControls((int)sctc, false, false);
5840 ControllingClient.SendTakeControls((int)sctc, true, false); 5859 ControllingClient.SendTakeControls((int)sctc, true, false);
@@ -6830,5 +6849,42 @@ namespace OpenSim.Region.Framework.Scenes
6830 { 6849 {
6831 return Overrides.GetOverriddenAnimation(animState); 6850 return Overrides.GetOverriddenAnimation(animState);
6832 } 6851 }
6852
6853 // http caps assets bandwidth control
6854 private int m_capbandwidth = -1;
6855 private int m_bandwidth = 100000;
6856 private int m_bandwidthBurst = 20000;
6857 private int m_bytesControl;
6858 private double m_lastBandwithTime;
6859
6860 public bool CapCanSendAsset(int type, int size)
6861 {
6862 if(size == 0)
6863 return true;
6864
6865 if(type > 1)
6866 {
6867 // not texture or mesh
6868 m_bytesControl -= size;
6869 return true;
6870 }
6871
6872 double currenttime = Util.GetTimeStamp();
6873 double timeElapsed = currenttime - m_lastBandwithTime;
6874 if (timeElapsed > .05)
6875 {
6876 m_lastBandwithTime = currenttime;
6877 int add = (int)(m_bandwidth * timeElapsed);
6878 m_bytesControl += add;
6879 if (m_bytesControl > m_bandwidthBurst)
6880 m_bytesControl = m_bandwidthBurst;
6881 }
6882 if (m_bytesControl > 0 )
6883 {
6884 m_bytesControl -= size;
6885 return true;
6886 }
6887 return false;
6888 }
6833 } 6889 }
6834} 6890}