aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2013-04-25 01:38:21 +0200
committerMelanie2013-04-25 01:38:21 +0200
commite39156c6569b10d48b0005b271f103387e16f527 (patch)
tree5599a3ecf8b5d57731f92890c66af2a61ff3b363 /OpenSim
parentGods module cleanup (diff)
downloadopensim-SC_OLD-e39156c6569b10d48b0005b271f103387e16f527.zip
opensim-SC_OLD-e39156c6569b10d48b0005b271f103387e16f527.tar.gz
opensim-SC_OLD-e39156c6569b10d48b0005b271f103387e16f527.tar.bz2
opensim-SC_OLD-e39156c6569b10d48b0005b271f103387e16f527.tar.xz
Send 503 when throttling textures
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs34
2 files changed, 34 insertions, 2 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index 07bd48a..7628e23 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -345,7 +345,7 @@ namespace OpenSim.Framework.Servers.HttpServer
345 if (responsedata == null) 345 if (responsedata == null)
346 continue; 346 continue;
347 347
348 if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) 348 if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) // This is the event queue
349 { 349 {
350 try 350 try
351 { 351 {
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();