aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/BasicDOSProtector.cs (renamed from OpenSim/Framework/Servers/HttpServer/BasicDOSProtector.cs)30
1 files changed, 29 insertions, 1 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BasicDOSProtector.cs b/OpenSim/Framework/BasicDOSProtector.cs
index 50a4ea2..b470161 100644
--- a/OpenSim/Framework/Servers/HttpServer/BasicDOSProtector.cs
+++ b/OpenSim/Framework/BasicDOSProtector.cs
@@ -29,7 +29,7 @@ using System.Collections.Generic;
29using System.Reflection; 29using System.Reflection;
30using log4net; 30using log4net;
31 31
32namespace OpenSim.Framework.Servers.HttpServer 32namespace OpenSim.Framework
33{ 33{
34 34
35 public class BasicDOSProtector 35 public class BasicDOSProtector
@@ -91,6 +91,27 @@ namespace OpenSim.Framework.Servers.HttpServer
91 91
92 _forgetTimer.Interval = _options.ForgetTimeSpan.TotalMilliseconds; 92 _forgetTimer.Interval = _options.ForgetTimeSpan.TotalMilliseconds;
93 } 93 }
94
95 /// <summary>
96 /// Given a string Key, Returns if that context is blocked
97 /// </summary>
98 /// <param name="key">A Key identifying the context</param>
99 /// <returns>bool Yes or No, True or False for blocked</returns>
100 public bool IsBlocked(string key)
101 {
102 bool ret = false;
103 _lockSlim.EnterReadLock();
104 ret = _tempBlocked.ContainsKey(key);
105 _lockSlim.ExitReadLock();
106 return ret;
107 }
108
109 /// <summary>
110 /// Process the velocity of this context
111 /// </summary>
112 /// <param name="key"></param>
113 /// <param name="endpoint"></param>
114 /// <returns></returns>
94 public bool Process(string key, string endpoint) 115 public bool Process(string key, string endpoint)
95 { 116 {
96 if (_options.MaxRequestsInTimeframe < 1 || _options.RequestTimeSpan.TotalMilliseconds < 1) 117 if (_options.MaxRequestsInTimeframe < 1 || _options.RequestTimeSpan.TotalMilliseconds < 1)
@@ -126,6 +147,13 @@ namespace OpenSim.Framework.Servers.HttpServer
126 } 147 }
127 return true; 148 return true;
128 } 149 }
150
151 /// <summary>
152 /// At this point, the rate limiting code needs to track 'per user' velocity.
153 /// </summary>
154 /// <param name="key">Context Key, string representing a rate limiting context</param>
155 /// <param name="endpoint"></param>
156 /// <returns></returns>
129 private bool DeeperInspection(string key, string endpoint) 157 private bool DeeperInspection(string key, string endpoint)
130 { 158 {
131 lock (_deeperInspection) 159 lock (_deeperInspection)