diff options
* 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 '')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs | 42 |
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 | } |