From ab77b22f0f2efce0913af3195faef96d593e89be Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 17 Dec 2008 17:33:57 +0000 Subject: [PATCH] * Only serialize packets once for the length calculation for throttle queues rather than twice --- .../ClientStack/LindenUDP/LLPacketQueue.cs | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs index 3ce71dc019..2d02dfc585 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs @@ -344,9 +344,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP { LLQueItem qpack = ResendOutgoingPacketQueue.Dequeue(); - SendQueue.Enqueue(qpack); - TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); - ResendThrottle.AddBytes(qpack.Packet.ToBytes().Length); + SendQueue.Enqueue(qpack); + int qpackSize = qpack.Packet.ToBytes().Length; + TotalThrottle.AddBytes(qpackSize); + ResendThrottle.AddBytes(qpackSize); + qchanged = true; } @@ -355,8 +357,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP LLQueItem qpack = LandOutgoingPacketQueue.Dequeue(); SendQueue.Enqueue(qpack); - TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); - LandThrottle.AddBytes(qpack.Packet.ToBytes().Length); + int qpackSize = qpack.Packet.ToBytes().Length; + TotalThrottle.AddBytes(qpackSize); + LandThrottle.AddBytes(qpackSize); qchanged = true; } @@ -365,8 +368,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP LLQueItem qpack = WindOutgoingPacketQueue.Dequeue(); SendQueue.Enqueue(qpack); - TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); - WindThrottle.AddBytes(qpack.Packet.ToBytes().Length); + int qpackSize = qpack.Packet.ToBytes().Length; + TotalThrottle.AddBytes(qpackSize); + WindThrottle.AddBytes(qpackSize); qchanged = true; } @@ -375,8 +379,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP LLQueItem qpack = CloudOutgoingPacketQueue.Dequeue(); SendQueue.Enqueue(qpack); - TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); - CloudThrottle.AddBytes(qpack.Packet.ToBytes().Length); + int qpackSize = qpack.Packet.ToBytes().Length; + TotalThrottle.AddBytes(qpackSize); + CloudThrottle.AddBytes(qpackSize); qchanged = true; } @@ -393,8 +398,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP qpack = TaskLowpriorityPacketQueue.Dequeue(); SendQueue.Enqueue(qpack); } - TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); - TaskThrottle.AddBytes(qpack.Packet.ToBytes().Length); + + int qpackSize = qpack.Packet.ToBytes().Length; + TotalThrottle.AddBytes(qpackSize); + TaskThrottle.AddBytes(qpackSize); qchanged = true; } @@ -402,9 +409,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP { LLQueItem qpack = TextureOutgoingPacketQueue.Dequeue(); - SendQueue.Enqueue(qpack); - TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); - TextureThrottle.AddBytes(qpack.Packet.ToBytes().Length); + SendQueue.Enqueue(qpack); + int qpackSize = qpack.Packet.ToBytes().Length; + TotalThrottle.AddBytes(qpackSize); + TextureThrottle.AddBytes(qpackSize); qchanged = true; } @@ -413,8 +421,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP LLQueItem qpack = AssetOutgoingPacketQueue.Dequeue(); SendQueue.Enqueue(qpack); - TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); - AssetThrottle.AddBytes(qpack.Packet.ToBytes().Length); + int qpackSize = qpack.Packet.ToBytes().Length; + TotalThrottle.AddBytes(qpackSize); + AssetThrottle.AddBytes(qpackSize); qchanged = true; } }