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.cs92
1 files changed, 61 insertions, 31 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index b01c7dc..d77cf0c 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); 224 private CapsDataThrottler m_throttler = new CapsDataThrottler(100000);
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
@@ -235,6 +236,16 @@ namespace OpenSim.Region.ClientStack.Linden
235 236
236 } 237 }
237 }; 238 };
239
240 Drop = (x, y) =>
241 {
242 lock (responses)
243 {
244 responses.Remove(x);
245 dropedResponses.Add(x);
246 }
247 };
248
238 GetEvents = (x, y) => 249 GetEvents = (x, y) =>
239 { 250 {
240 lock (responses) 251 lock (responses)
@@ -305,53 +316,72 @@ namespace OpenSim.Region.ClientStack.Linden
305 if(m_scene.ShuttingDown) 316 if(m_scene.ShuttingDown)
306 return; 317 return;
307 318
308 if (requestinfo.send503) 319 lock (responses)
309 { 320 {
310 response = new Hashtable(); 321 lock(dropedResponses)
322 {
323 if(dropedResponses.Contains(requestID))
324 {
325 dropedResponses.Remove(requestID);
326 return;
327 }
328 }
311 329
312 response["int_response_code"] = 503; 330 if (requestinfo.send503)
313 response["str_response_string"] = "Throttled"; 331 {
314 response["content_type"] = "text/plain"; 332 response = new Hashtable();
315 response["keepalive"] = false;
316 response["reusecontext"] = false;
317 333
318 Hashtable headers = new Hashtable(); 334 response["int_response_code"] = 503;
319 headers["Retry-After"] = 30; 335 response["str_response_string"] = "Throttled";
320 response["headers"] = headers; 336 response["content_type"] = "text/plain";
337 response["keepalive"] = false;
338 response["reusecontext"] = false;
339
340 Hashtable headers = new Hashtable();
341 headers["Retry-After"] = 30;
342 response["headers"] = headers;
321 343
322 lock (responses)
323 responses[requestID] = new aPollResponse() {bytes = 0, response = response}; 344 responses[requestID] = new aPollResponse() {bytes = 0, response = response};
324 345
325 return; 346 return;
326 } 347 }
327 348
328 // If the avatar is gone, don't bother to get the texture 349 // If the avatar is gone, don't bother to get the texture
329 if (m_scene.GetScenePresence(Id) == null) 350 if (m_scene.GetScenePresence(Id) == null)
330 { 351 {
331 response = new Hashtable(); 352 response = new Hashtable();
332 353
333 response["int_response_code"] = 500; 354 response["int_response_code"] = 500;
334 response["str_response_string"] = "Script timeout"; 355 response["str_response_string"] = "Script timeout";
335 response["content_type"] = "text/plain"; 356 response["content_type"] = "text/plain";
336 response["keepalive"] = false; 357 response["keepalive"] = false;
337 response["reusecontext"] = false; 358 response["reusecontext"] = false;
338 359
339 lock (responses)
340 responses[requestID] = new aPollResponse() {bytes = 0, response = response}; 360 responses[requestID] = new aPollResponse() {bytes = 0, response = response};
341 361
342 return; 362 return;
363 }
343 } 364 }
344 365
345 response = m_getTextureHandler.Handle(requestinfo.request); 366 response = m_getTextureHandler.Handle(requestinfo.request);
367
346 lock (responses) 368 lock (responses)
347 { 369 {
370 lock(dropedResponses)
371 {
372 if(dropedResponses.Contains(requestID))
373 {
374 dropedResponses.Remove(requestID);
375 m_throttler.ProcessTime();
376 return;
377 }
378 }
348 responses[requestID] = new aPollResponse() 379 responses[requestID] = new aPollResponse()
349 { 380 {
350 bytes = (int) response["int_bytes"], 381 bytes = (int) response["int_bytes"],
351 response = response 382 response = response
352 }; 383 };
353 384 }
354 }
355 m_throttler.PassTime(); 385 m_throttler.PassTime();
356 } 386 }
357 387
@@ -476,7 +506,7 @@ namespace OpenSim.Region.ClientStack.Linden
476 return; 506 return;
477 int add = (int)(ThrottleBytes * timeElapsed * 0.001); 507 int add = (int)(ThrottleBytes * timeElapsed * 0.001);
478 if (add >= 1000) 508 if (add >= 1000)
479 { 509 {
480 lastTimeElapsed = currenttime; 510 lastTimeElapsed = currenttime;
481 BytesSent -= add; 511 BytesSent -= add;
482 if (BytesSent < 0) BytesSent = 0; 512 if (BytesSent < 0) BytesSent = 0;