aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDiva Canto2011-02-10 06:26:26 -0800
committerDiva Canto2011-02-10 06:26:26 -0800
commit45382e6f828395cbbcc1324d366c4f3e0eff7ad7 (patch)
treef4d2453535d1bdc614630f61e288fa1b5f0dc894 /OpenSim/Region
parentRevert "Hunting down mantis #5365" (diff)
downloadopensim-SC_OLD-45382e6f828395cbbcc1324d366c4f3e0eff7ad7.zip
opensim-SC_OLD-45382e6f828395cbbcc1324d366c4f3e0eff7ad7.tar.gz
opensim-SC_OLD-45382e6f828395cbbcc1324d366c4f3e0eff7ad7.tar.bz2
opensim-SC_OLD-45382e6f828395cbbcc1324d366c4f3e0eff7ad7.tar.xz
Reinstated a couple of null checks related to the previous revert.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs26
1 files changed, 15 insertions, 11 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
index 9d40688..d195110 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
@@ -143,7 +143,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
143 // Process all the pending adds 143 // Process all the pending adds
144 OutgoingPacket pendingAdd; 144 OutgoingPacket pendingAdd;
145 while (m_pendingAdds.TryDequeue(out pendingAdd)) 145 while (m_pendingAdds.TryDequeue(out pendingAdd))
146 m_packets[pendingAdd.SequenceNumber] = pendingAdd; 146 if (pendingAdd != null)
147 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
147 148
148 // Process all the pending removes, including updating statistics and round-trip times 149 // Process all the pending removes, including updating statistics and round-trip times
149 PendingAck pendingRemove; 150 PendingAck pendingRemove;
@@ -152,17 +153,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
152 { 153 {
153 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) 154 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
154 { 155 {
155 m_packets.Remove(pendingRemove.SequenceNumber); 156 if (ackedPacket != null)
156
157 // Update stats
158 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
159
160 if (!pendingRemove.FromResend)
161 { 157 {
162 // Calculate the round-trip time for this packet and its ACK 158 m_packets.Remove(pendingRemove.SequenceNumber);
163 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; 159
164 if (rtt > 0) 160 // Update stats
165 ackedPacket.Client.UpdateRoundTrip(rtt); 161 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
162
163 if (!pendingRemove.FromResend)
164 {
165 // Calculate the round-trip time for this packet and its ACK
166 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
167 if (rtt > 0)
168 ackedPacket.Client.UpdateRoundTrip(rtt);
169 }
166 } 170 }
167 } 171 }
168 } 172 }