From 766ce9a14146dc9814d488364f5c931d0fa96a17 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 4 Oct 2010 00:04:42 +0200 Subject: Add linden prim renderer and update libOMV --- .../LindenUDP/UnackedPacketCollection.cs | 47 ++++++++++++++-------- 1 file changed, 31 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index e43f7cf..c19e6a2 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs @@ -1,4 +1,4 @@ -/* + * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -139,28 +139,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void ProcessQueues() { // Process all the pending adds - OutgoingPacket pendingAdd; - while (m_pendingAdds.Dequeue(out pendingAdd)) - m_packets[pendingAdd.SequenceNumber] = pendingAdd; + OutgoingPacket pendingAdd; + if (m_pendingAdds != null) + { + while (m_pendingAdds.TryDequeue(out pendingAdd)) + { + if (pendingAdd != null && m_packets != null) + { + m_packets[pendingAdd.SequenceNumber] = pendingAdd; + } + } + } + // Process all the pending removes, including updating statistics and round-trip times PendingAck pendingRemove; OutgoingPacket ackedPacket; - while (m_pendingRemoves.Dequeue(out pendingRemove)) + if (m_pendingRemoves != null) { - if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) + while (m_pendingRemoves.TryDequeue(out pendingRemove)) { - m_packets.Remove(pendingRemove.SequenceNumber); - - // Update stats - System.Threading.Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); - - if (!pendingRemove.FromResend) + if (m_pendingRemoves != null && m_packets != null) { - // Calculate the round-trip time for this packet and its ACK - int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; - if (rtt > 0) - ackedPacket.Client.UpdateRoundTrip(rtt); + if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) + { + m_packets.Remove(pendingRemove.SequenceNumber); + + // Update stats + System.Threading.Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); + + if (!pendingRemove.FromResend) + { + // Calculate the round-trip time for this packet and its ACK + int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; + if (rtt > 0) + ackedPacket.Client.UpdateRoundTrip(rtt); + } + } } } } -- cgit v1.1