From f2ca9c1d052bfc6a16fc399e2fe219da77bbcf57 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 16 Jan 2008 12:33:02 +0000 Subject: * Reverted bugfx that really should go into separate commit --- OpenSim/Region/ClientStack/ClientView.cs | 37 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index d6c9d1d..e74aee7 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -416,7 +416,7 @@ namespace OpenSim.Region.ClientStack { // this will normally trigger at least one packet (ping response) SendStartPingCheck(0); - + } } else @@ -424,7 +424,7 @@ namespace OpenSim.Region.ClientStack // Something received in the meantime - we can reset the counters m_probesWithNoIngressPackets = 0; m_lastPacketsReceived = m_packetsReceived; - + } } @@ -2311,7 +2311,7 @@ namespace OpenSim.Region.ClientStack if (Pack.Header.Reliable) //DIRTY HACK { AddAck(Pack); // this adds the need to ack this packet later - + if (Pack.Type != PacketType.PacketAck && Pack.Type != PacketType.LogoutRequest) { @@ -2355,15 +2355,10 @@ namespace OpenSim.Region.ClientStack { lock (m_needAck) { - foreach (uint ackedPacketId in NewPack.Header.AckList) + foreach (uint ack in NewPack.Header.AckList) { - Packet ackedPacket; - - if (m_needAck.TryGetValue(ackedPacketId, out ackedPacket)) - { - m_unAckedBytes -= ackedPacket.ToBytes().Length; - m_needAck.Remove(ackedPacketId); - } + m_unAckedBytes -= m_needAck[ack].ToBytes().Length; + m_needAck.Remove(ack); } } } @@ -2378,12 +2373,18 @@ namespace OpenSim.Region.ClientStack { foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) { - uint ackedPackId = block.ID; - Packet ackedPacket; - if (m_needAck.TryGetValue(ackedPackId, out ackedPacket)) + if (m_needAck.ContainsKey(block.ID)) { - m_unAckedBytes -= ackedPacket.ToBytes().Length; - m_needAck.Remove(ackedPackId); + try + { + m_unAckedBytes -= m_needAck[block.ID].ToBytes().Length; + m_needAck.Remove(block.ID); + } + catch (System.Collections.Generic.KeyNotFoundException) + { + // Did another packet come in with the ack already? + // apparently so! + } } } } @@ -2499,11 +2500,11 @@ namespace OpenSim.Region.ClientStack protected void AckTimer_Elapsed(object sender, ElapsedEventArgs ea) { - + SendAcks(); ResendUnacked(); SendPacketStats(); - + } protected void SendPacketStats() -- cgit v1.1