aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs29
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs27
2 files changed, 14 insertions, 42 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
index 5be75fa..8a5fb85 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
@@ -244,9 +244,7 @@ namespace OpenSim.Region.ClientStack.Linden
244 { 244 {
245 lock (responses) 245 lock (responses)
246 { 246 {
247 bool ret = m_throttler.hasEvents(x, responses); 247 return m_throttler.hasEvents(x, responses);
248 return ret;
249
250 } 248 }
251 }; 249 };
252 250
@@ -434,43 +432,32 @@ namespace OpenSim.Region.ClientStack.Linden
434 if(pBytes < 10000) 432 if(pBytes < 10000)
435 pBytes = 10000; 433 pBytes = 10000;
436 ThrottleBytes = pBytes; 434 ThrottleBytes = pBytes;
437 lastTimeElapsed = Util.GetTimeStampMS(); 435 lastTimeElapsed = Util.GetTimeStamp();
438 } 436 }
439 437
440 public bool hasEvents(UUID key, Dictionary<UUID, APollResponse> responses) 438 public bool hasEvents(UUID key, Dictionary<UUID, APollResponse> responses)
441 { 439 {
442 PassTime(); 440 PassTime();
443 // Note, this is called IN LOCK 441 APollResponse response;
444 bool haskey = responses.ContainsKey(key);
445
446 if (!haskey)
447 {
448 return false;
449 }
450 APollResponse response;
451 if (responses.TryGetValue(key, out response)) 442 if (responses.TryGetValue(key, out response))
452 { 443 {
453 // Normal 444 // Normal
454 if (BytesSent <= ThrottleBytes) 445 if (response.bytes == 0 || BytesSent <= ThrottleBytes)
455 { 446 {
456 BytesSent += response.bytes; 447 BytesSent += response.bytes;
457 return true; 448 return true;
458 } 449 }
459 else
460 {
461 return false;
462 }
463 } 450 }
464 return haskey; 451 return false;
465 } 452 }
466 453
467 public void PassTime() 454 public void PassTime()
468 { 455 {
469 double currenttime = Util.GetTimeStampMS(); 456 double currenttime = Util.GetTimeStamp();
470 double timeElapsed = currenttime - lastTimeElapsed; 457 double timeElapsed = currenttime - lastTimeElapsed;
471 if(timeElapsed < 50.0) 458 if(timeElapsed < .05)
472 return; 459 return;
473 int add = (int)(ThrottleBytes * timeElapsed * 0.001); 460 int add = (int)(ThrottleBytes * timeElapsed);
474 if (add >= 1000) 461 if (add >= 1000)
475 { 462 {
476 lastTimeElapsed = currenttime; 463 lastTimeElapsed = currenttime;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index b206739..974f9a4 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -450,46 +450,31 @@ namespace OpenSim.Region.ClientStack.Linden
450 if(pBytes < 10000) 450 if(pBytes < 10000)
451 pBytes = 10000; 451 pBytes = 10000;
452 ThrottleBytes = pBytes; 452 ThrottleBytes = pBytes;
453 lastTimeElapsed = Util.GetTimeStampMS(); 453 lastTimeElapsed = Util.GetTimeStamp();
454 } 454 }
455 public bool hasEvents(UUID key, Dictionary<UUID, GetTextureModule.APollResponse> responses) 455 public bool hasEvents(UUID key, Dictionary<UUID, GetTextureModule.APollResponse> responses)
456 { 456 {
457 PassTime(); 457 PassTime();
458 // Note, this is called IN LOCK 458 // Note, this is called IN LOCK
459 bool haskey = responses.ContainsKey(key);
460 if (!haskey)
461 {
462 return false;
463 }
464 GetTextureModule.APollResponse response; 459 GetTextureModule.APollResponse response;
465 if (responses.TryGetValue(key, out response)) 460 if (responses.TryGetValue(key, out response))
466 { 461 {
467 // This is any error response 462 if (response.bytes == 0 || BytesSent <= ThrottleBytes)
468 if (response.bytes == 0)
469 return true;
470
471 // Normal
472 if (BytesSent <= ThrottleBytes)
473 { 463 {
474 BytesSent += response.bytes; 464 BytesSent += response.bytes;
475 return true; 465 return true;
476 } 466 }
477 else
478 {
479 return false;
480 }
481 } 467 }
482 468 return false;
483 return haskey;
484 } 469 }
485 470
486 public void PassTime() 471 public void PassTime()
487 { 472 {
488 double currenttime = Util.GetTimeStampMS(); 473 double currenttime = Util.GetTimeStamp();
489 double timeElapsed = currenttime - lastTimeElapsed; 474 double timeElapsed = currenttime - lastTimeElapsed;
490 if(timeElapsed < 50.0) 475 if(timeElapsed < .05)
491 return; 476 return;
492 int add = (int)(ThrottleBytes * timeElapsed * 0.001); 477 int add = (int)(ThrottleBytes * timeElapsed);
493 if (add >= 1000) 478 if (add >= 1000)
494 { 479 {
495 lastTimeElapsed = currenttime; 480 lastTimeElapsed = currenttime;