diff options
author | Melanie Thielker | 2008-12-17 17:05:12 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-12-17 17:05:12 +0000 |
commit | 8e5fe0257c59f13631c1e2676c838a0d4009bbb1 (patch) | |
tree | 208070357f41a4c351f3223e4c52d36977022766 /OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | |
parent | * minor: Minor documentation and small minor change on LLPacketThrottle to re... (diff) | |
download | opensim-SC-8e5fe0257c59f13631c1e2676c838a0d4009bbb1.zip opensim-SC-8e5fe0257c59f13631c1e2676c838a0d4009bbb1.tar.gz opensim-SC-8e5fe0257c59f13631c1e2676c838a0d4009bbb1.tar.bz2 opensim-SC-8e5fe0257c59f13631c1e2676c838a0d4009bbb1.tar.xz |
Mantis #2850
Applying the patch to reduce the load caused by the throttle loop even more
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs index 81f3922..a8785a6 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | |||
@@ -327,11 +327,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
327 | // we've hit the throttle limit or there's no more packets to send | 327 | // we've hit the throttle limit or there's no more packets to send |
328 | lock (this) | 328 | lock (this) |
329 | { | 329 | { |
330 | // this variable will be true if there was work done in the last execution of the | ||
331 | // loop, since each pass through the loop checks the queue length, we no longer | ||
332 | // need the check on entering the loop | ||
333 | bool qchanged = true; | ||
330 | ResetCounters(); | 334 | ResetCounters(); |
331 | // m_log.Info("[THROTTLE]: Entering Throttle"); | 335 | // m_log.Info("[THROTTLE]: Entering Throttle"); |
332 | while (TotalThrottle.UnderLimit() && PacketsWaiting() && | 336 | while (TotalThrottle.UnderLimit() && qchanged && |
333 | (throttleLoops <= MaxThrottleLoops)) | 337 | (throttleLoops <= MaxThrottleLoops)) |
334 | { | 338 | { |
339 | qchanged = false; // We will break out of the loop if no work was accomplished | ||
340 | |||
335 | throttleLoops++; | 341 | throttleLoops++; |
336 | //Now comes the fun part.. we dump all our elements into m_packetQueue that we've saved up. | 342 | //Now comes the fun part.. we dump all our elements into m_packetQueue that we've saved up. |
337 | if ((ResendOutgoingPacketQueue.Count > 0) && ResendThrottle.UnderLimit()) | 343 | if ((ResendOutgoingPacketQueue.Count > 0) && ResendThrottle.UnderLimit()) |
@@ -341,6 +347,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
341 | SendQueue.Enqueue(qpack); | 347 | SendQueue.Enqueue(qpack); |
342 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 348 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
343 | ResendThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 349 | ResendThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
350 | qchanged = true; | ||
344 | } | 351 | } |
345 | 352 | ||
346 | if ((LandOutgoingPacketQueue.Count > 0) && LandThrottle.UnderLimit()) | 353 | if ((LandOutgoingPacketQueue.Count > 0) && LandThrottle.UnderLimit()) |
@@ -350,6 +357,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
350 | SendQueue.Enqueue(qpack); | 357 | SendQueue.Enqueue(qpack); |
351 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 358 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
352 | LandThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 359 | LandThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
360 | qchanged = true; | ||
353 | } | 361 | } |
354 | 362 | ||
355 | if ((WindOutgoingPacketQueue.Count > 0) && WindThrottle.UnderLimit()) | 363 | if ((WindOutgoingPacketQueue.Count > 0) && WindThrottle.UnderLimit()) |
@@ -359,6 +367,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
359 | SendQueue.Enqueue(qpack); | 367 | SendQueue.Enqueue(qpack); |
360 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 368 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
361 | WindThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 369 | WindThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
370 | qchanged = true; | ||
362 | } | 371 | } |
363 | 372 | ||
364 | if ((CloudOutgoingPacketQueue.Count > 0) && CloudThrottle.UnderLimit()) | 373 | if ((CloudOutgoingPacketQueue.Count > 0) && CloudThrottle.UnderLimit()) |
@@ -368,6 +377,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
368 | SendQueue.Enqueue(qpack); | 377 | SendQueue.Enqueue(qpack); |
369 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 378 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
370 | CloudThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 379 | CloudThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
380 | qchanged = true; | ||
371 | } | 381 | } |
372 | 382 | ||
373 | if ((TaskOutgoingPacketQueue.Count > 0 || TaskLowpriorityPacketQueue.Count > 0) && TaskThrottle.UnderLimit()) | 383 | if ((TaskOutgoingPacketQueue.Count > 0 || TaskLowpriorityPacketQueue.Count > 0) && TaskThrottle.UnderLimit()) |
@@ -385,6 +395,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
385 | } | 395 | } |
386 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 396 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
387 | TaskThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 397 | TaskThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
398 | qchanged = true; | ||
388 | } | 399 | } |
389 | 400 | ||
390 | if ((TextureOutgoingPacketQueue.Count > 0) && TextureThrottle.UnderLimit()) | 401 | if ((TextureOutgoingPacketQueue.Count > 0) && TextureThrottle.UnderLimit()) |
@@ -394,6 +405,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
394 | SendQueue.Enqueue(qpack); | 405 | SendQueue.Enqueue(qpack); |
395 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 406 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
396 | TextureThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 407 | TextureThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
408 | qchanged = true; | ||
397 | } | 409 | } |
398 | 410 | ||
399 | if ((AssetOutgoingPacketQueue.Count > 0) && AssetThrottle.UnderLimit()) | 411 | if ((AssetOutgoingPacketQueue.Count > 0) && AssetThrottle.UnderLimit()) |
@@ -403,6 +415,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
403 | SendQueue.Enqueue(qpack); | 415 | SendQueue.Enqueue(qpack); |
404 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 416 | TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
405 | AssetThrottle.AddBytes(qpack.Packet.ToBytes().Length); | 417 | AssetThrottle.AddBytes(qpack.Packet.ToBytes().Length); |
418 | qchanged = true; | ||
406 | } | 419 | } |
407 | } | 420 | } |
408 | // m_log.Info("[THROTTLE]: Processed " + throttleLoops + " packets"); | 421 | // m_log.Info("[THROTTLE]: Processed " + throttleLoops + " packets"); |