aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs')
-rw-r--r--OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs38
1 files changed, 19 insertions, 19 deletions
diff --git a/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs
index dfa05fa..bb72029 100644
--- a/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs
+++ b/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs
@@ -31,14 +31,14 @@ namespace OpenSim.Framework.Communications.Limit
31{ 31{
32 /// <summary> 32 /// <summary>
33 /// Limit requests by discarding them after they've been repeated a certain number of times. 33 /// Limit requests by discarding them after they've been repeated a certain number of times.
34 /// </summary> 34 /// </summary>
35 public class RepeatLimitStrategy<TId> : IRequestLimitStrategy<TId> 35 public class RepeatLimitStrategy<TId> : IRequestLimitStrategy<TId>
36 { 36 {
37 /// <summary> 37 /// <summary>
38 /// Record each asset request that we're notified about. 38 /// Record each asset request that we're notified about.
39 /// </summary> 39 /// </summary>
40 private readonly Dictionary<TId, int> requestCounts = new Dictionary<TId, int>(); 40 private readonly Dictionary<TId, int> requestCounts = new Dictionary<TId, int>();
41 41
42 /// <summary> 42 /// <summary>
43 /// The maximum number of requests that can be made before we drop subsequent requests. 43 /// The maximum number of requests that can be made before we drop subsequent requests.
44 /// </summary> 44 /// </summary>
@@ -47,7 +47,7 @@ namespace OpenSim.Framework.Communications.Limit
47 { 47 {
48 get { return m_maxRequests; } 48 get { return m_maxRequests; }
49 } 49 }
50 50
51 /// <summary></summary> 51 /// <summary></summary>
52 /// <param name="maxRequests">The maximum number of requests that may be served before all further 52 /// <param name="maxRequests">The maximum number of requests that may be served before all further
53 /// requests are dropped.</param> 53 /// requests are dropped.</param>
@@ -55,52 +55,52 @@ namespace OpenSim.Framework.Communications.Limit
55 { 55 {
56 m_maxRequests = maxRequests; 56 m_maxRequests = maxRequests;
57 } 57 }
58 58
59 /// <summary> 59 /// <summary>
60 /// <see cref="IRequestLimitStrategy"/> 60 /// <see cref="IRequestLimitStrategy"/>
61 /// </summary> 61 /// </summary>
62 public bool AllowRequest(TId id) 62 public bool AllowRequest(TId id)
63 { 63 {
64 if (requestCounts.ContainsKey(id)) 64 if (requestCounts.ContainsKey(id))
65 { 65 {
66 requestCounts[id] += 1; 66 requestCounts[id] += 1;
67 67
68 if (requestCounts[id] > m_maxRequests) 68 if (requestCounts[id] > m_maxRequests)
69 { 69 {
70 return false; 70 return false;
71 } 71 }
72 } 72 }
73 73
74 return true; 74 return true;
75 } 75 }
76 76
77 /// <summary> 77 /// <summary>
78 /// <see cref="IRequestLimitStrategy"/> 78 /// <see cref="IRequestLimitStrategy"/>
79 /// </summary> 79 /// </summary>
80 public bool IsFirstRefusal(TId id) 80 public bool IsFirstRefusal(TId id)
81 { 81 {
82 if (requestCounts.ContainsKey(id) && m_maxRequests + 1 == requestCounts[id]) 82 if (requestCounts.ContainsKey(id) && m_maxRequests + 1 == requestCounts[id])
83 { 83 {
84 return true; 84 return true;
85 } 85 }
86 86
87 return false; 87 return false;
88 } 88 }
89 89
90 /// <summary> 90 /// <summary>
91 /// <see cref="IRequestLimitStrategy"/> 91 /// <see cref="IRequestLimitStrategy"/>
92 /// </summary> 92 /// </summary>
93 public void MonitorRequests(TId id) 93 public void MonitorRequests(TId id)
94 { 94 {
95 if (!IsMonitoringRequests(id)) 95 if (!IsMonitoringRequests(id))
96 { 96 {
97 requestCounts.Add(id, 1); 97 requestCounts.Add(id, 1);
98 } 98 }
99 } 99 }
100 100
101 /// <summary> 101 /// <summary>
102 /// <see cref="IRequestLimitStrategy"/> 102 /// <see cref="IRequestLimitStrategy"/>
103 /// </summary> 103 /// </summary>
104 public bool IsMonitoringRequests(TId id) 104 public bool IsMonitoringRequests(TId id)
105 { 105 {
106 return requestCounts.ContainsKey(id); 106 return requestCounts.ContainsKey(id);