aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs
diff options
context:
space:
mode:
authorlbsa712008-07-21 10:02:55 +0000
committerlbsa712008-07-21 10:02:55 +0000
commit9dbb6f28bc7e91b4643d2e80e2182f273d7e9121 (patch)
tree07f3101eeac8c7bd9970317b513d20d54a986870 /OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs
parentsome optimizations in quaternion normalization in llRot2Fwd, llRot2Left, and ... (diff)
downloadopensim-SC_OLD-9dbb6f28bc7e91b4643d2e80e2182f273d7e9121.zip
opensim-SC_OLD-9dbb6f28bc7e91b4643d2e80e2182f273d7e9121.tar.gz
opensim-SC_OLD-9dbb6f28bc7e91b4643d2e80e2182f273d7e9121.tar.bz2
opensim-SC_OLD-9dbb6f28bc7e91b4643d2e80e2182f273d7e9121.tar.xz
* eliminated some warnings and added some const and readonlies
* refactored some member names for readability and ccc (code convention conformance) * took away two refs from Rest.Inventory since * System.IO is part of System * System.Xml.Serialization is part of System.Xml
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs42
1 files changed, 21 insertions, 21 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs
index cd5ff7e..b9f4594 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs
@@ -29,63 +29,63 @@ namespace OpenSim.Region.ClientStack.LindenUDP
29{ 29{
30 public class LLPacketThrottle 30 public class LLPacketThrottle
31 { 31 {
32 private int max; // max allowable throttle 32 private readonly int m_maxAllowableThrottle;
33 private int min; // min allowable throttle 33 private readonly int m_minAllowableThrottle;
34 private int throttle; // current throttle setting 34 private int m_currentThrottle;
35 private static int divisor = 7; // the throttle time divisor, this probably should factor out 35 private const int m_throttleTimeDivisor = 7;
36 private int sent; // current number of bytes sent 36 private int m_currentBytesSent;
37 37
38 public LLPacketThrottle(int Min, int Max, int Throttle) 38 public LLPacketThrottle(int Min, int Max, int Throttle)
39 { 39 {
40 max = Max; 40 m_maxAllowableThrottle = Max;
41 min = Min; 41 m_minAllowableThrottle = Min;
42 throttle = Throttle; 42 m_currentThrottle = Throttle;
43 sent = 0; 43 m_currentBytesSent = 0;
44 } 44 }
45 45
46 public void Reset() 46 public void Reset()
47 { 47 {
48 sent = 0; 48 m_currentBytesSent = 0;
49 } 49 }
50 50
51 public bool UnderLimit() 51 public bool UnderLimit()
52 { 52 {
53 return (sent < (throttle/divisor)); 53 return (m_currentBytesSent < (m_currentThrottle/m_throttleTimeDivisor));
54 } 54 }
55 55
56 public int Add(int bytes) 56 public int Add(int bytes)
57 { 57 {
58 sent += bytes; 58 m_currentBytesSent += bytes;
59 return sent; 59 return m_currentBytesSent;
60 } 60 }
61 61
62 // Properties 62 // Properties
63 public int Max 63 public int Max
64 { 64 {
65 get { return max; } 65 get { return m_maxAllowableThrottle; }
66 } 66 }
67 67
68 public int Min 68 public int Min
69 { 69 {
70 get { return min; } 70 get { return m_minAllowableThrottle; }
71 } 71 }
72 72
73 public int Throttle 73 public int Throttle
74 { 74 {
75 get { return throttle; } 75 get { return m_currentThrottle; }
76 set 76 set
77 { 77 {
78 if (value > max) 78 if (value > m_maxAllowableThrottle)
79 { 79 {
80 throttle = max; 80 m_currentThrottle = m_maxAllowableThrottle;
81 } 81 }
82 else if (value < min) 82 else if (value < m_minAllowableThrottle)
83 { 83 {
84 throttle = min; 84 m_currentThrottle = m_minAllowableThrottle;
85 } 85 }
86 else 86 else
87 { 87 {
88 throttle = value; 88 m_currentThrottle = value;
89 } 89 }
90 } 90 }
91 } 91 }