diff options
author | teravus | 2012-11-22 08:13:35 -0500 |
---|---|---|
committer | teravus | 2012-11-22 08:13:35 -0500 |
commit | 98b0cb8df8128d516c128cb78a58170e22a484b9 (patch) | |
tree | 67268ad4bda7dd02c05aaf71fd730828c621dee9 /OpenSim/Region/ClientStack/Linden/Caps | |
parent | Merge branch 'teravuswork' into avination (diff) | |
download | opensim-SC-98b0cb8df8128d516c128cb78a58170e22a484b9.zip opensim-SC-98b0cb8df8128d516c128cb78a58170e22a484b9.tar.gz opensim-SC-98b0cb8df8128d516c128cb78a58170e22a484b9.tar.bz2 opensim-SC-98b0cb8df8128d516c128cb78a58170e22a484b9.tar.xz |
* While this is not producing any problems.. and does help in low bandwidth situations I can't demonstrate that it's better then just letting the client request what it needs in terms of responsiveness of the mesh in the scene yet.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 96b48ad..dd43328 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | |||
@@ -250,7 +250,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
250 | base(null, null, null, null, pId, int.MaxValue) | 250 | base(null, null, null, null, pId, int.MaxValue) |
251 | { | 251 | { |
252 | m_scene = scene; | 252 | m_scene = scene; |
253 | m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene); | 253 | m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene, pId); |
254 | // x is request id, y is userid | 254 | // x is request id, y is userid |
255 | HasEvents = (x, y) => | 255 | HasEvents = (x, y) => |
256 | { | 256 | { |
@@ -419,21 +419,35 @@ namespace OpenSim.Region.ClientStack.Linden | |||
419 | private float CapThrottleDistributon = 0.30f; | 419 | private float CapThrottleDistributon = 0.30f; |
420 | private readonly Scene m_scene; | 420 | private readonly Scene m_scene; |
421 | private ThrottleOutPacketType Throttle; | 421 | private ThrottleOutPacketType Throttle; |
422 | private readonly UUID User; | ||
422 | 423 | ||
423 | public MeshCapsDataThrottler(int pBytes, int max, int min, Scene pScene) | 424 | public MeshCapsDataThrottler(int pBytes, int max, int min, Scene pScene, UUID puser) |
424 | { | 425 | { |
425 | ThrottleBytes = pBytes; | 426 | ThrottleBytes = pBytes; |
426 | lastTimeElapsed = Util.EnvironmentTickCount(); | 427 | lastTimeElapsed = Util.EnvironmentTickCount(); |
427 | Throttle = ThrottleOutPacketType.Task; | 428 | Throttle = ThrottleOutPacketType.Task; |
428 | m_scene = pScene; | 429 | m_scene = pScene; |
430 | User = puser; | ||
429 | } | 431 | } |
430 | 432 | ||
431 | 433 | ||
432 | public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses) | 434 | public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses) |
433 | { | 435 | { |
436 | const float ThirtyPercent = 0.30f; | ||
437 | const float FivePercent = 0.05f; | ||
434 | PassTime(); | 438 | PassTime(); |
435 | // Note, this is called IN LOCK | 439 | // Note, this is called IN LOCK |
436 | bool haskey = responses.ContainsKey(key); | 440 | bool haskey = responses.ContainsKey(key); |
441 | |||
442 | if (responses.Count > 2) | ||
443 | { | ||
444 | SplitThrottle(ThirtyPercent); | ||
445 | } | ||
446 | else | ||
447 | { | ||
448 | SplitThrottle(FivePercent); | ||
449 | } | ||
450 | |||
437 | if (!haskey) | 451 | if (!haskey) |
438 | { | 452 | { |
439 | return false; | 453 | return false; |
@@ -441,7 +455,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
441 | aPollResponse response; | 455 | aPollResponse response; |
442 | if (responses.TryGetValue(key, out response)) | 456 | if (responses.TryGetValue(key, out response)) |
443 | { | 457 | { |
444 | 458 | float LOD3Over = (((ThrottleBytes*CapThrottleDistributon)%50000) + 1); | |
459 | float LOD2Over = (((ThrottleBytes*CapThrottleDistributon)%10000) + 1); | ||
445 | // Normal | 460 | // Normal |
446 | if (BytesSent + response.bytes <= ThrottleBytes) | 461 | if (BytesSent + response.bytes <= ThrottleBytes) |
447 | { | 462 | { |
@@ -449,16 +464,16 @@ namespace OpenSim.Region.ClientStack.Linden | |||
449 | 464 | ||
450 | return true; | 465 | return true; |
451 | } | 466 | } |
452 | // Lod3 Over | 467 | // Lod3 Over Throttle protection to keep things processing even when the throttle bandwidth is set too little. |
453 | else if (response.bytes > ThrottleBytes && Lod3 <= (((ThrottleBytes * .30f) % 50000) + 1)) | 468 | else if (response.bytes > ThrottleBytes && Lod3 <= ((LOD3Over < 1)? 1: LOD3Over) ) |
454 | { | 469 | { |
455 | Interlocked.Increment(ref Lod3); | 470 | Interlocked.Increment(ref Lod3); |
456 | BytesSent += response.bytes; | 471 | BytesSent += response.bytes; |
457 | 472 | ||
458 | return true; | 473 | return true; |
459 | } | 474 | } |
460 | // Lod2 Over | 475 | // Lod2 Over Throttle protection to keep things processing even when the throttle bandwidth is set too little. |
461 | else if (response.bytes > ThrottleBytes && Lod2 <= (((ThrottleBytes * .30f) % 10000) + 1)) | 476 | else if (response.bytes > ThrottleBytes && Lod2 <= ((LOD2Over < 1) ? 1 : LOD2Over)) |
462 | { | 477 | { |
463 | Interlocked.Increment(ref Lod2); | 478 | Interlocked.Increment(ref Lod2); |
464 | BytesSent += response.bytes; | 479 | BytesSent += response.bytes; |
@@ -477,7 +492,20 @@ namespace OpenSim.Region.ClientStack.Linden | |||
477 | { | 492 | { |
478 | BytesSent -= bytes; | 493 | BytesSent -= bytes; |
479 | } | 494 | } |
495 | private void SplitThrottle(float percentMultiplier) | ||
496 | { | ||
480 | 497 | ||
498 | if (CapThrottleDistributon != percentMultiplier) // don't switch it if it's already set at the % multipler | ||
499 | { | ||
500 | CapThrottleDistributon = percentMultiplier; | ||
501 | ScenePresence p; | ||
502 | if (m_scene.TryGetScenePresence(User, out p)) // If we don't get a user they're not here anymore. | ||
503 | { | ||
504 | AlterThrottle(UserSetThrottle, p); | ||
505 | } | ||
506 | } | ||
507 | } | ||
508 | |||
481 | public void ProcessTime() | 509 | public void ProcessTime() |
482 | { | 510 | { |
483 | PassTime(); | 511 | PassTime(); |