aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
diff options
context:
space:
mode:
authorUbitUmarov2016-07-16 19:53:41 +0100
committerUbitUmarov2016-07-16 19:53:41 +0100
commitd1810866b3177c9c6026f619426c1bda72e14374 (patch)
tree1549ce924af875d296fcb67ef606e2c6a8e76228 /OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
parent disable OSHttpTests that will collide with testing new http server changes (diff)
downloadopensim-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/GetMeshModule.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs94
1 files changed, 15 insertions, 79 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
index 95d9c99..f66ef57 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
@@ -389,11 +389,6 @@ namespace OpenSim.Region.ClientStack.Linden
389 private volatile int currenttime = 0; 389 private volatile int currenttime = 0;
390 private volatile int lastTimeElapsed = 0; 390 private volatile int lastTimeElapsed = 0;
391 private volatile int BytesSent = 0; 391 private volatile int BytesSent = 0;
392 private int Lod3 = 0;
393 private int Lod2 = 0;
394// private int Lod1 = 0;
395 private int UserSetThrottle = 0;
396 private int UDPSetThrottle = 0;
397 private int CapSetThrottle = 0; 392 private int CapSetThrottle = 0;
398 private float CapThrottleDistributon = 0.30f; 393 private float CapThrottleDistributon = 0.30f;
399 private readonly Scene m_scene; 394 private readonly Scene m_scene;
@@ -403,6 +398,8 @@ namespace OpenSim.Region.ClientStack.Linden
403 public MeshCapsDataThrottler(int pBytes, int max, int min, Scene pScene, UUID puser) 398 public MeshCapsDataThrottler(int pBytes, int max, int min, Scene pScene, UUID puser)
404 { 399 {
405 ThrottleBytes = pBytes; 400 ThrottleBytes = pBytes;
401 if(ThrottleBytes < 10000)
402 ThrottleBytes = 10000;
406 lastTimeElapsed = Util.EnvironmentTickCount(); 403 lastTimeElapsed = Util.EnvironmentTickCount();
407 Throttle = ThrottleOutPacketType.Asset; 404 Throttle = ThrottleOutPacketType.Asset;
408 m_scene = pScene; 405 m_scene = pScene;
@@ -411,21 +408,10 @@ namespace OpenSim.Region.ClientStack.Linden
411 408
412 public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses) 409 public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses)
413 { 410 {
414 const float ThirtyPercent = 0.30f;
415 const float FivePercent = 0.05f;
416 PassTime(); 411 PassTime();
417 // Note, this is called IN LOCK 412 // Note, this is called IN LOCK
418 bool haskey = responses.ContainsKey(key); 413 bool haskey = responses.ContainsKey(key);
419 414
420 if (responses.Count > 2)
421 {
422 SplitThrottle(ThirtyPercent);
423 }
424 else
425 {
426 SplitThrottle(FivePercent);
427 }
428
429 if (!haskey) 415 if (!haskey)
430 { 416 {
431 return false; 417 return false;
@@ -433,29 +419,10 @@ namespace OpenSim.Region.ClientStack.Linden
433 aPollResponse response; 419 aPollResponse response;
434 if (responses.TryGetValue(key, out response)) 420 if (responses.TryGetValue(key, out response))
435 { 421 {
436 float LOD3Over = (((ThrottleBytes*CapThrottleDistributon)%50000) + 1);
437 float LOD2Over = (((ThrottleBytes*CapThrottleDistributon)%10000) + 1);
438 // Normal 422 // Normal
439 if (BytesSent + response.bytes <= ThrottleBytes) 423 if (BytesSent <= ThrottleBytes)
440 {
441 BytesSent += response.bytes;
442
443 return true;
444 }
445 // Lod3 Over Throttle protection to keep things processing even when the throttle bandwidth is set too little.
446 else if (response.bytes > ThrottleBytes && Lod3 <= ((LOD3Over < 1)? 1: LOD3Over) )
447 {
448 Interlocked.Increment(ref Lod3);
449 BytesSent += response.bytes;
450
451 return true;
452 }
453 // Lod2 Over Throttle protection to keep things processing even when the throttle bandwidth is set too little.
454 else if (response.bytes > ThrottleBytes && Lod2 <= ((LOD2Over < 1) ? 1 : LOD2Over))
455 { 424 {
456 Interlocked.Increment(ref Lod2); 425 BytesSent += response.bytes;
457 BytesSent += response.bytes;
458
459 return true; 426 return true;
460 } 427 }
461 else 428 else
@@ -463,27 +430,8 @@ namespace OpenSim.Region.ClientStack.Linden
463 return false; 430 return false;
464 } 431 }
465 } 432 }
466
467 return haskey; 433 return haskey;
468 } 434 }
469 public void SubtractBytes(int bytes,int lod)
470 {
471 BytesSent -= bytes;
472 }
473 private void SplitThrottle(float percentMultiplier)
474 {
475
476 if (CapThrottleDistributon != percentMultiplier) // don't switch it if it's already set at the % multipler
477 {
478 CapThrottleDistributon = percentMultiplier;
479 ScenePresence p;
480 if (m_scene.TryGetScenePresence(User, out p)) // If we don't get a user they're not here anymore.
481 {
482// AlterThrottle(UserSetThrottle, p);
483 UpdateThrottle(UserSetThrottle, p);
484 }
485 }
486 }
487 435
488 public void ProcessTime() 436 public void ProcessTime()
489 { 437 {
@@ -494,18 +442,11 @@ namespace OpenSim.Region.ClientStack.Linden
494 { 442 {
495 currenttime = Util.EnvironmentTickCount(); 443 currenttime = Util.EnvironmentTickCount();
496 int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); 444 int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed);
497 //processTimeBasedActions(responses); 445 if (timeElapsed >= 100)
498 if (currenttime - timeElapsed >= 1000)
499 { 446 {
500 lastTimeElapsed = Util.EnvironmentTickCount(); 447 lastTimeElapsed = currenttime;
501 BytesSent -= ThrottleBytes; 448 BytesSent -= (ThrottleBytes * timeElapsed / 1000);
502 if (BytesSent < 0) BytesSent = 0; 449 if (BytesSent < 0) BytesSent = 0;
503 if (BytesSent < ThrottleBytes)
504 {
505 Lod3 = 0;
506 Lod2 = 0;
507// Lod1 = 0;
508 }
509 } 450 }
510 } 451 }
511 452
@@ -517,25 +458,20 @@ namespace OpenSim.Region.ClientStack.Linden
517 public int ThrottleBytes 458 public int ThrottleBytes
518 { 459 {
519 get { return CapSetThrottle; } 460 get { return CapSetThrottle; }
520 set { CapSetThrottle = value; } 461 set
462 {
463 if (value > 10000)
464 CapSetThrottle = value;
465 else
466 CapSetThrottle = 10000;
467 }
521 } 468 }
522 469
523 internal void UpdateThrottle(int pimagethrottle, ScenePresence p) 470 internal void UpdateThrottle(int pimagethrottle, ScenePresence p)
524 { 471 {
525 // Client set throttle ! 472 // Client set throttle !
526 UserSetThrottle = pimagethrottle; 473 CapSetThrottle = 2 * pimagethrottle;
527 CapSetThrottle = (int)(pimagethrottle*CapThrottleDistributon);
528// UDPSetThrottle = (int) (pimagethrottle*(100 - CapThrottleDistributon));
529
530 float udp = 1.0f - CapThrottleDistributon;
531 if(udp < 0.7f)
532 udp = 0.7f;
533 UDPSetThrottle = (int) ((float)pimagethrottle * udp);
534 if (CapSetThrottle < 4068)
535 CapSetThrottle = 4068; // at least two discovery mesh
536 p.ControllingClient.SetAgentThrottleSilent((int) Throttle, UDPSetThrottle);
537 ProcessTime(); 474 ProcessTime();
538
539 } 475 }
540 } 476 }
541 } 477 }