diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index d762bef..d195110 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs | |||
@@ -141,46 +141,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
141 | private void ProcessQueues() | 141 | private void ProcessQueues() |
142 | { | 142 | { |
143 | // Process all the pending adds | 143 | // Process all the pending adds |
144 | |||
145 | OutgoingPacket pendingAdd; | 144 | OutgoingPacket pendingAdd; |
146 | if (m_pendingAdds != null) | 145 | while (m_pendingAdds.TryDequeue(out pendingAdd)) |
147 | { | 146 | if (pendingAdd != null) |
148 | while (m_pendingAdds.TryDequeue(out pendingAdd)) | 147 | m_packets[pendingAdd.SequenceNumber] = pendingAdd; |
149 | { | ||
150 | if (pendingAdd != null && m_packets != null) | ||
151 | { | ||
152 | m_packets[pendingAdd.SequenceNumber] = pendingAdd; | ||
153 | } | ||
154 | } | ||
155 | } | ||
156 | 148 | ||
157 | // 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 |
158 | PendingAck pendingRemove; | 150 | PendingAck pendingRemove; |
159 | OutgoingPacket ackedPacket; | 151 | OutgoingPacket ackedPacket; |
160 | if (m_pendingRemoves != null) | 152 | while (m_pendingRemoves.TryDequeue(out pendingRemove)) |
161 | { | 153 | { |
162 | while (m_pendingRemoves.TryDequeue(out pendingRemove)) | 154 | if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) |
163 | { | 155 | { |
164 | if (m_pendingRemoves != null && m_packets != null) | 156 | if (ackedPacket != null) |
165 | { | 157 | { |
166 | if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) | 158 | m_packets.Remove(pendingRemove.SequenceNumber); |
159 | |||
160 | // Update stats | ||
161 | Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); | ||
162 | |||
163 | if (!pendingRemove.FromResend) | ||
167 | { | 164 | { |
168 | m_packets.Remove(pendingRemove.SequenceNumber); | 165 | // Calculate the round-trip time for this packet and its ACK |
169 | 166 | int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; | |
170 | // Update stats | 167 | if (rtt > 0) |
171 | Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); | 168 | ackedPacket.Client.UpdateRoundTrip(rtt); |
172 | |||
173 | if (!pendingRemove.FromResend) | ||
174 | { | ||
175 | // Calculate the round-trip time for this packet and its ACK | ||
176 | int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; | ||
177 | if (rtt > 0) | ||
178 | ackedPacket.Client.UpdateRoundTrip(rtt); | ||
179 | } | ||
180 | } | 169 | } |
181 | } | 170 | } |
182 | } | 171 | } |
183 | } | 172 | } |
184 | } | 173 | } |
185 | } | 174 | } |
186 | } | 175 | } \ No newline at end of file |