diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/PacketThrottle.cs | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/OpenSim/Region/ClientStack/PacketThrottle.cs b/OpenSim/Region/ClientStack/PacketThrottle.cs index f9a5c09..f56f4f8 100644 --- a/OpenSim/Region/ClientStack/PacketThrottle.cs +++ b/OpenSim/Region/ClientStack/PacketThrottle.cs | |||
@@ -25,26 +25,10 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Net; | ||
31 | using System.Net.Sockets; | ||
32 | using System.Text; | ||
33 | using System.Threading; | ||
34 | using System.Timers; | ||
35 | using Axiom.Math; | ||
36 | using libsecondlife; | ||
37 | using libsecondlife.Packets; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Communications.Cache; | ||
40 | using OpenSim.Framework.Console; | ||
41 | using Timer=System.Timers.Timer; | ||
42 | |||
43 | namespace OpenSim.Region.ClientStack | 28 | namespace OpenSim.Region.ClientStack |
44 | { | 29 | { |
45 | public class PacketThrottle | 30 | public class PacketThrottle |
46 | { | 31 | { |
47 | |||
48 | private int max; // max allowable throttle | 32 | private int max; // max allowable throttle |
49 | private int min; // min allowable throttle | 33 | private int min; // min allowable throttle |
50 | private int throttle; // current throttle setting | 34 | private int throttle; // current throttle setting |
@@ -63,10 +47,10 @@ namespace OpenSim.Region.ClientStack | |||
63 | { | 47 | { |
64 | sent = 0; | 48 | sent = 0; |
65 | } | 49 | } |
66 | 50 | ||
67 | public bool UnderLimit() | 51 | public bool UnderLimit() |
68 | { | 52 | { |
69 | return (sent < (throttle / divisor)); | 53 | return (sent < (throttle/divisor)); |
70 | } | 54 | } |
71 | 55 | ||
72 | public int Add(int bytes) | 56 | public int Add(int bytes) |
@@ -78,27 +62,32 @@ namespace OpenSim.Region.ClientStack | |||
78 | // Properties | 62 | // Properties |
79 | public int Max | 63 | public int Max |
80 | { | 64 | { |
81 | get {return max;} | 65 | get { return max; } |
82 | } | 66 | } |
83 | 67 | ||
84 | public int Min | 68 | public int Min |
85 | { | 69 | { |
86 | get {return min;} | 70 | get { return min; } |
87 | } | 71 | } |
88 | 72 | ||
89 | public int Throttle | 73 | public int Throttle |
90 | { | 74 | { |
91 | get {return throttle;} | 75 | get { return throttle; } |
92 | set | 76 | set |
93 | { | 77 | { |
94 | if (value > max) { | 78 | if (value > max) |
79 | { | ||
95 | throttle = max; | 80 | throttle = max; |
96 | } else if (value < min) { | 81 | } |
82 | else if (value < min) | ||
83 | { | ||
97 | throttle = min; | 84 | throttle = min; |
98 | } else { | 85 | } |
86 | else | ||
87 | { | ||
99 | throttle = value; | 88 | throttle = value; |
100 | } | 89 | } |
101 | } | 90 | } |
102 | } | 91 | } |
103 | } | 92 | } |
104 | } | 93 | } \ No newline at end of file |