diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs new file mode 100644 index 0000000..858a03c --- /dev/null +++ b/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using Nini.Config; | ||
30 | |||
31 | namespace OpenSim.Region.ClientStack.LindenUDP | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// Holds drip rates and maximum burst rates for throttling with hierarchical | ||
35 | /// token buckets. The maximum burst rates set here are hard limits and can | ||
36 | /// not be overridden by client requests | ||
37 | /// </summary> | ||
38 | public sealed class ThrottleRates | ||
39 | { | ||
40 | /// <summary>Drip rate for resent packets</summary> | ||
41 | public int Resend; | ||
42 | /// <summary>Drip rate for terrain packets</summary> | ||
43 | public int Land; | ||
44 | /// <summary>Drip rate for wind packets</summary> | ||
45 | public int Wind; | ||
46 | /// <summary>Drip rate for cloud packets</summary> | ||
47 | public int Cloud; | ||
48 | /// <summary>Drip rate for task (state and transaction) packets</summary> | ||
49 | public int Task; | ||
50 | /// <summary>Drip rate for texture packets</summary> | ||
51 | public int Texture; | ||
52 | /// <summary>Drip rate for asset packets</summary> | ||
53 | public int Asset; | ||
54 | |||
55 | /// <summary>Maximum burst rate for resent packets</summary> | ||
56 | public int ResendLimit; | ||
57 | /// <summary>Maximum burst rate for land packets</summary> | ||
58 | public int LandLimit; | ||
59 | /// <summary>Maximum burst rate for wind packets</summary> | ||
60 | public int WindLimit; | ||
61 | /// <summary>Maximum burst rate for cloud packets</summary> | ||
62 | public int CloudLimit; | ||
63 | /// <summary>Maximum burst rate for task (state and transaction) packets</summary> | ||
64 | public int TaskLimit; | ||
65 | /// <summary>Maximum burst rate for texture packets</summary> | ||
66 | public int TextureLimit; | ||
67 | /// <summary>Maximum burst rate for asset packets</summary> | ||
68 | public int AssetLimit; | ||
69 | |||
70 | /// <summary> | ||
71 | /// Default constructor | ||
72 | /// </summary> | ||
73 | /// <param name="config">Config source to load defaults from</param> | ||
74 | public ThrottleRates(IConfigSource config) | ||
75 | { | ||
76 | try | ||
77 | { | ||
78 | IConfig throttleConfig = config.Configs["ClientStack.LindenUDP"]; | ||
79 | |||
80 | Resend = throttleConfig.GetInt("ResendDefault", 12500); | ||
81 | Land = throttleConfig.GetInt("LandDefault", 500); | ||
82 | Wind = throttleConfig.GetInt("WindDefault", 500); | ||
83 | Cloud = throttleConfig.GetInt("CloudDefault", 500); | ||
84 | Task = throttleConfig.GetInt("TaskDefault", 500); | ||
85 | Texture = throttleConfig.GetInt("TextureDefault", 500); | ||
86 | Asset = throttleConfig.GetInt("AssetDefault", 500); | ||
87 | |||
88 | ResendLimit = throttleConfig.GetInt("ResendLimit", 18750); | ||
89 | LandLimit = throttleConfig.GetInt("LandLimit", 29750); | ||
90 | WindLimit = throttleConfig.GetInt("WindLimit", 18750); | ||
91 | CloudLimit = throttleConfig.GetInt("CloudLimit", 18750); | ||
92 | TaskLimit = throttleConfig.GetInt("TaskLimit", 55750); | ||
93 | TextureLimit = throttleConfig.GetInt("TextureLimit", 55750); | ||
94 | AssetLimit = throttleConfig.GetInt("AssetLimit", 27500); | ||
95 | } | ||
96 | catch (Exception) { } | ||
97 | } | ||
98 | } | ||
99 | } | ||