diff options
author | UbitUmarov | 2016-07-16 19:53:41 +0100 |
---|---|---|
committer | UbitUmarov | 2016-07-16 19:53:41 +0100 |
commit | d1810866b3177c9c6026f619426c1bda72e14374 (patch) | |
tree | 1549ce924af875d296fcb67ef606e2c6a8e76228 /OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |
parent | disable OSHttpTests that will collide with testing new http server changes (diff) | |
download | opensim-SC_OLD-d1810866b3177c9c6026f619426c1bda72e14374.zip opensim-SC_OLD-d1810866b3177c9c6026f619426c1bda72e14374.tar.gz opensim-SC_OLD-d1810866b3177c9c6026f619426c1bda72e14374.tar.bz2 opensim-SC_OLD-d1810866b3177c9c6026f619426c1bda72e14374.tar.xz |
simplify http textures and meshs Throttles
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 0c4e227..14a59fe 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -356,7 +356,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
356 | 356 | ||
357 | internal void UpdateThrottle(int pimagethrottle) | 357 | internal void UpdateThrottle(int pimagethrottle) |
358 | { | 358 | { |
359 | m_throttler.ThrottleBytes = pimagethrottle; | 359 | m_throttler.ThrottleBytes = 2 * pimagethrottle; |
360 | if(m_throttler.ThrottleBytes < 10000) | ||
361 | m_throttler.ThrottleBytes = 10000; | ||
360 | } | 362 | } |
361 | } | 363 | } |
362 | 364 | ||
@@ -425,10 +427,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
425 | private volatile int currenttime = 0; | 427 | private volatile int currenttime = 0; |
426 | private volatile int lastTimeElapsed = 0; | 428 | private volatile int lastTimeElapsed = 0; |
427 | private volatile int BytesSent = 0; | 429 | private volatile int BytesSent = 0; |
428 | private int oversizedImages = 0; | ||
429 | public CapsDataThrottler(int pBytes, int max, int min) | 430 | public CapsDataThrottler(int pBytes, int max, int min) |
430 | { | 431 | { |
431 | ThrottleBytes = pBytes; | 432 | ThrottleBytes = pBytes; |
433 | if(ThrottleBytes < 10000) | ||
434 | ThrottleBytes = 10000; | ||
432 | lastTimeElapsed = Util.EnvironmentTickCount(); | 435 | lastTimeElapsed = Util.EnvironmentTickCount(); |
433 | } | 436 | } |
434 | public bool hasEvents(UUID key, Dictionary<UUID, GetTextureModule.aPollResponse> responses) | 437 | public bool hasEvents(UUID key, Dictionary<UUID, GetTextureModule.aPollResponse> responses) |
@@ -448,20 +451,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
448 | return true; | 451 | return true; |
449 | 452 | ||
450 | // Normal | 453 | // Normal |
451 | if (BytesSent + response.bytes <= ThrottleBytes) | 454 | if (BytesSent <= ThrottleBytes) |
452 | { | 455 | { |
453 | BytesSent += response.bytes; | 456 | BytesSent += response.bytes; |
454 | //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + 1000, unlockyn = false }; | ||
455 | //m_actions.Add(timeBasedAction); | ||
456 | return true; | ||
457 | } | ||
458 | // Big textures | ||
459 | else if (response.bytes > ThrottleBytes && oversizedImages <= ((ThrottleBytes % 50000) + 1)) | ||
460 | { | ||
461 | Interlocked.Increment(ref oversizedImages); | ||
462 | BytesSent += response.bytes; | ||
463 | //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + (((response.bytes % ThrottleBytes)+1)*1000) , unlockyn = false }; | ||
464 | //m_actions.Add(timeBasedAction); | ||
465 | return true; | 457 | return true; |
466 | } | 458 | } |
467 | else | 459 | else |
@@ -483,15 +475,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
483 | currenttime = Util.EnvironmentTickCount(); | 475 | currenttime = Util.EnvironmentTickCount(); |
484 | int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); | 476 | int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); |
485 | //processTimeBasedActions(responses); | 477 | //processTimeBasedActions(responses); |
486 | if (Util.EnvironmentTickCountSubtract(currenttime, timeElapsed) >= 1000) | 478 | if (timeElapsed >= 100) |
487 | { | 479 | { |
488 | lastTimeElapsed = Util.EnvironmentTickCount(); | 480 | lastTimeElapsed = currenttime; |
489 | BytesSent -= ThrottleBytes; | 481 | BytesSent -= (ThrottleBytes * timeElapsed / 1000); |
490 | if (BytesSent < 0) BytesSent = 0; | 482 | if (BytesSent < 0) BytesSent = 0; |
491 | if (BytesSent < ThrottleBytes) | ||
492 | { | ||
493 | oversizedImages = 0; | ||
494 | } | ||
495 | } | 483 | } |
496 | } | 484 | } |
497 | public int ThrottleBytes; | 485 | public int ThrottleBytes; |