aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs14
1 files changed, 10 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs
index e0eee53..1f978e1 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs
@@ -189,8 +189,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
189 // Process all the pending adds 189 // Process all the pending adds
190 OutgoingPacket pendingAdd; 190 OutgoingPacket pendingAdd;
191 while (m_pendingAdds.TryDequeue(out pendingAdd)) 191 while (m_pendingAdds.TryDequeue(out pendingAdd))
192 {
192 if (pendingAdd != null) 193 if (pendingAdd != null)
193 m_packets[pendingAdd.SequenceNumber] = pendingAdd; 194 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
195 }
194 196
195 // Process all the pending removes, including updating statistics and round-trip times 197 // Process all the pending removes, including updating statistics and round-trip times
196 PendingAck pendingAcknowledgement; 198 PendingAck pendingAcknowledgement;
@@ -203,15 +205,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
203 if (ackedPacket != null) 205 if (ackedPacket != null)
204 { 206 {
205 m_packets.Remove(pendingAcknowledgement.SequenceNumber); 207 m_packets.Remove(pendingAcknowledgement.SequenceNumber);
208
209 // Update stats
210 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
211
206 ackedPacket.Client.FreeUDPBuffer(ackedPacket.Buffer); 212 ackedPacket.Client.FreeUDPBuffer(ackedPacket.Buffer);
213 ackedPacket.Buffer = null;
207 214
208 // As with other network applications, assume that an acknowledged packet is an 215 // As with other network applications, assume that an acknowledged packet is an
209 // indication that the network can handle a little more load, speed up the transmission 216 // indication that the network can handle a little more load, speed up the transmission
210 ackedPacket.Client.FlowThrottle.AcknowledgePackets(1); 217 ackedPacket.Client.FlowThrottle.AcknowledgePackets(1);
211 218
212 // Update stats
213 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
214
215 if (!pendingAcknowledgement.FromResend) 219 if (!pendingAcknowledgement.FromResend)
216 { 220 {
217 // Calculate the round-trip time for this packet and its ACK 221 // Calculate the round-trip time for this packet and its ACK
@@ -242,10 +246,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
242 if (removedPacket != null) 246 if (removedPacket != null)
243 { 247 {
244 m_packets.Remove(pendingRemove); 248 m_packets.Remove(pendingRemove);
245 removedPacket.Client.FreeUDPBuffer(removedPacket.Buffer);
246 249
247 // Update stats 250 // Update stats
248 Interlocked.Add(ref removedPacket.Client.UnackedBytes, -removedPacket.Buffer.DataLength); 251 Interlocked.Add(ref removedPacket.Client.UnackedBytes, -removedPacket.Buffer.DataLength);
252
253 removedPacket.Client.FreeUDPBuffer(removedPacket.Buffer);
254 removedPacket.Buffer = null;
249 } 255 }
250 } 256 }
251 } 257 }