aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs93
1 files changed, 61 insertions, 32 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index 14a59fe..15c0967 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -218,11 +218,12 @@ namespace OpenSim.Region.ClientStack.Linden
218 new List<Hashtable>(); 218 new List<Hashtable>();
219 private Dictionary<UUID, aPollResponse> responses = 219 private Dictionary<UUID, aPollResponse> responses =
220 new Dictionary<UUID, aPollResponse>(); 220 new Dictionary<UUID, aPollResponse>();
221 private HashSet<UUID> dropedResponses = new HashSet<UUID>();
221 222
222 private Scene m_scene; 223 private Scene m_scene;
223 private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000); 224 private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000);
224 public PollServiceTextureEventArgs(UUID pId, Scene scene) : 225 public PollServiceTextureEventArgs(UUID pId, Scene scene) :
225 base(null, "", null, null, null, pId, int.MaxValue) 226 base(null, "", null, null, null, null, pId, int.MaxValue)
226 { 227 {
227 m_scene = scene; 228 m_scene = scene;
228 // x is request id, y is userid 229 // x is request id, y is userid
@@ -236,6 +237,16 @@ namespace OpenSim.Region.ClientStack.Linden
236 237
237 } 238 }
238 }; 239 };
240
241 Drop = (x, y) =>
242 {
243 lock (responses)
244 {
245 responses.Remove(x);
246 dropedResponses.Add(x);
247 }
248 };
249
239 GetEvents = (x, y) => 250 GetEvents = (x, y) =>
240 { 251 {
241 lock (responses) 252 lock (responses)
@@ -304,52 +315,71 @@ namespace OpenSim.Region.ClientStack.Linden
304 if(m_scene.ShuttingDown) 315 if(m_scene.ShuttingDown)
305 return; 316 return;
306 317
307 if (requestinfo.send503) 318 lock (responses)
308 { 319 {
309 response = new Hashtable(); 320 lock(dropedResponses)
321 {
322 if(dropedResponses.Contains(requestID))
323 {
324 dropedResponses.Remove(requestID);
325 return;
326 }
327 }
310 328
311 response["int_response_code"] = 503; 329 if (requestinfo.send503)
312 response["str_response_string"] = "Throttled"; 330 {
313 response["content_type"] = "text/plain"; 331 response = new Hashtable();
314 response["keepalive"] = false;
315 response["reusecontext"] = false;
316 332
317 Hashtable headers = new Hashtable(); 333 response["int_response_code"] = 503;
318 headers["Retry-After"] = 30; 334 response["str_response_string"] = "Throttled";
319 response["headers"] = headers; 335 response["content_type"] = "text/plain";
320 336 response["keepalive"] = false;
321 lock (responses) 337 response["reusecontext"] = false;
338
339 Hashtable headers = new Hashtable();
340 headers["Retry-After"] = 30;
341 response["headers"] = headers;
342
322 responses[requestID] = new aPollResponse() {bytes = 0, response = response}; 343 responses[requestID] = new aPollResponse() {bytes = 0, response = response};
323 344
324 return; 345 return;
325 } 346 }
326 347
327 // If the avatar is gone, don't bother to get the texture 348 // If the avatar is gone, don't bother to get the texture
328 if (m_scene.GetScenePresence(Id) == null) 349 if (m_scene.GetScenePresence(Id) == null)
329 { 350 {
330 response = new Hashtable(); 351 response = new Hashtable();
331 352
332 response["int_response_code"] = 500; 353 response["int_response_code"] = 500;
333 response["str_response_string"] = "Script timeout"; 354 response["str_response_string"] = "Script timeout";
334 response["content_type"] = "text/plain"; 355 response["content_type"] = "text/plain";
335 response["keepalive"] = false; 356 response["keepalive"] = false;
336 response["reusecontext"] = false; 357 response["reusecontext"] = false;
337 358
338 lock (responses)
339 responses[requestID] = new aPollResponse() {bytes = 0, response = response}; 359 responses[requestID] = new aPollResponse() {bytes = 0, response = response};
340 360
341 return; 361 return;
362 }
342 } 363 }
343 364
344 response = m_getTextureHandler.Handle(requestinfo.request); 365 response = m_getTextureHandler.Handle(requestinfo.request);
366
345 lock (responses) 367 lock (responses)
346 { 368 {
369 lock(dropedResponses)
370 {
371 if(dropedResponses.Contains(requestID))
372 {
373 dropedResponses.Remove(requestID);
374 m_throttler.ProcessTime();
375 return;
376 }
377 }
347 responses[requestID] = new aPollResponse() 378 responses[requestID] = new aPollResponse()
348 { 379 {
349 bytes = (int) response["int_bytes"], 380 bytes = (int) response["int_bytes"],
350 response = response 381 response = response
351 }; 382 };
352
353 } 383 }
354 m_throttler.ProcessTime(); 384 m_throttler.ProcessTime();
355 } 385 }
@@ -423,7 +453,6 @@ namespace OpenSim.Region.ClientStack.Linden
423 453
424 internal sealed class CapsDataThrottler 454 internal sealed class CapsDataThrottler
425 { 455 {
426
427 private volatile int currenttime = 0; 456 private volatile int currenttime = 0;
428 private volatile int lastTimeElapsed = 0; 457 private volatile int lastTimeElapsed = 0;
429 private volatile int BytesSent = 0; 458 private volatile int BytesSent = 0;