diff options
author | Melanie | 2013-04-25 01:38:21 +0200 |
---|---|---|
committer | Melanie | 2013-04-25 01:38:21 +0200 |
commit | e39156c6569b10d48b0005b271f103387e16f527 (patch) | |
tree | 5599a3ecf8b5d57731f92890c66af2a61ff3b363 /OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |
parent | Gods module cleanup (diff) | |
download | opensim-SC-e39156c6569b10d48b0005b271f103387e16f527.zip opensim-SC-e39156c6569b10d48b0005b271f103387e16f527.tar.gz opensim-SC-e39156c6569b10d48b0005b271f103387e16f527.tar.bz2 opensim-SC-e39156c6569b10d48b0005b271f103387e16f527.tar.xz |
Send 503 when throttling textures
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index d4dbfb9..a42c96c 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -56,6 +56,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
56 | public PollServiceTextureEventArgs thepoll; | 56 | public PollServiceTextureEventArgs thepoll; |
57 | public UUID reqID; | 57 | public UUID reqID; |
58 | public Hashtable request; | 58 | public Hashtable request; |
59 | public bool send503; | ||
59 | } | 60 | } |
60 | 61 | ||
61 | public class aPollResponse | 62 | public class aPollResponse |
@@ -244,7 +245,19 @@ namespace OpenSim.Region.ClientStack.Linden | |||
244 | reqinfo.thepoll = this; | 245 | reqinfo.thepoll = this; |
245 | reqinfo.reqID = x; | 246 | reqinfo.reqID = x; |
246 | reqinfo.request = y; | 247 | reqinfo.request = y; |
248 | reqinfo.send503 = false; | ||
247 | 249 | ||
250 | lock (responses) | ||
251 | { | ||
252 | if (responses.Count > 0) | ||
253 | { | ||
254 | if (m_queue.Count >= 4) | ||
255 | { | ||
256 | // Never allow more than 4 fetches to wait | ||
257 | reqinfo.send503 = true; | ||
258 | } | ||
259 | } | ||
260 | } | ||
248 | m_queue.Enqueue(reqinfo); | 261 | m_queue.Enqueue(reqinfo); |
249 | }; | 262 | }; |
250 | 263 | ||
@@ -276,6 +289,22 @@ namespace OpenSim.Region.ClientStack.Linden | |||
276 | 289 | ||
277 | UUID requestID = requestinfo.reqID; | 290 | UUID requestID = requestinfo.reqID; |
278 | 291 | ||
292 | if (requestinfo.send503) | ||
293 | { | ||
294 | response = new Hashtable(); | ||
295 | |||
296 | response["int_response_code"] = 503; | ||
297 | response["str_response_string"] = "Throttled"; | ||
298 | response["content_type"] = "text/plain"; | ||
299 | response["keepalive"] = false; | ||
300 | response["reusecontext"] = false; | ||
301 | |||
302 | lock (responses) | ||
303 | responses[requestID] = new aPollResponse() {bytes = 0, response = response}; | ||
304 | |||
305 | return; | ||
306 | } | ||
307 | |||
279 | // If the avatar is gone, don't bother to get the texture | 308 | // If the avatar is gone, don't bother to get the texture |
280 | if (m_scene.GetScenePresence(Id) == null) | 309 | if (m_scene.GetScenePresence(Id) == null) |
281 | { | 310 | { |
@@ -385,6 +414,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
385 | GetTextureModule.aPollResponse response; | 414 | GetTextureModule.aPollResponse response; |
386 | if (responses.TryGetValue(key, out response)) | 415 | if (responses.TryGetValue(key, out response)) |
387 | { | 416 | { |
417 | // This is any error response | ||
418 | if (response.bytes == 0) | ||
419 | return true; | ||
388 | 420 | ||
389 | // Normal | 421 | // Normal |
390 | if (BytesSent + response.bytes <= ThrottleBytes) | 422 | if (BytesSent + response.bytes <= ThrottleBytes) |
@@ -411,12 +443,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
411 | 443 | ||
412 | return haskey; | 444 | return haskey; |
413 | } | 445 | } |
446 | |||
414 | public void ProcessTime() | 447 | public void ProcessTime() |
415 | { | 448 | { |
416 | PassTime(); | 449 | PassTime(); |
417 | } | 450 | } |
418 | 451 | ||
419 | |||
420 | private void PassTime() | 452 | private void PassTime() |
421 | { | 453 | { |
422 | currenttime = Util.EnvironmentTickCount(); | 454 | currenttime = Util.EnvironmentTickCount(); |