aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-11-22 13:33:34 +0000
committerMelanie2012-11-22 13:33:34 +0000
commitc3e1701d438d1a687c38ae120b52d824d0e944ee (patch)
tree634a6a6de90fba16100d077de7f77811f2cc1af6 /OpenSim
parentMerge branch 'master' into careminster (diff)
parent* While this is not producing any problems.. and does help in low bandwidth ... (diff)
downloadopensim-SC_OLD-c3e1701d438d1a687c38ae120b52d824d0e944ee.zip
opensim-SC_OLD-c3e1701d438d1a687c38ae120b52d824d0e944ee.tar.gz
opensim-SC_OLD-c3e1701d438d1a687c38ae120b52d824d0e944ee.tar.bz2
opensim-SC_OLD-c3e1701d438d1a687c38ae120b52d824d0e944ee.tar.xz
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs42
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 d2c2ab2..6b33561 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();