diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 29 |
1 files changed, 8 insertions, 21 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; |