From cc5d49d9c170d1f96cb44174d790f78050c16141 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 24 Jul 2008 01:38:58 +0000 Subject: Addresses Mantis #1810 Collapses two locks into one to avoid a situation were a List is cloned under two different locks, resulting in a bad index in .NET code. --- .../Region/ClientStack/LindenUDP/LLPacketHandler.cs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs index 791ea32..31abadb 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs @@ -234,6 +234,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { DropResend(id); + AddAcks(ref packet); QueuePacket(packet, throttlePacketType, id); // We want to see that packet arrive if it's reliable @@ -245,10 +246,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - private void QueuePacket( - Packet packet, ThrottleOutPacketType throttlePacketType, - Object id) - { + private void AddAcks(ref Packet packet) + { // Add acks to outgoing packets // if (m_PendingAcks.Count > 0) @@ -269,7 +268,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP break; } } - + } + + private void QueuePacket( + Packet packet, ThrottleOutPacketType throttlePacketType, + Object id) + { packet.TickCount = System.Environment.TickCount; LLQueItem item = new LLQueItem(); @@ -352,7 +356,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // private void SendAcks() { - lock (m_PendingAcks) + lock (m_NeedAck) { if (m_PendingAcks.Count == 0) return; @@ -387,7 +391,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // private void AckPacket(Packet packet) { - lock (m_PendingAcks) + lock (m_NeedAck) { if (m_PendingAcks.Count < 250) { @@ -400,7 +404,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP SendAcks(); - lock (m_PendingAcks) + lock (m_NeedAck) { // If this is still full we have a truly exceptional // condition (means, can't happen) -- cgit v1.1