diff options
author | Justin Clark-Casey (justincc) | 2011-01-17 23:57:50 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-01-17 23:57:50 +0000 |
commit | 6e58996b4d9db202cd7795a37bd687362effef48 (patch) | |
tree | 638532ff30949c633e4b9cff263a60980a0c8628 /OpenSim/Region/ClientStack/LindenUDP | |
parent | Fix UnackedBytes client stack statistic as seen in "show queues" (diff) | |
download | opensim-SC_OLD-6e58996b4d9db202cd7795a37bd687362effef48.zip opensim-SC_OLD-6e58996b4d9db202cd7795a37bd687362effef48.tar.gz opensim-SC_OLD-6e58996b4d9db202cd7795a37bd687362effef48.tar.bz2 opensim-SC_OLD-6e58996b4d9db202cd7795a37bd687362effef48.tar.xz |
refactor: remove redundant null checks
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index d762bef..9d40688 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs | |||
@@ -141,46 +141,31 @@ 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 | m_packets[pendingAdd.SequenceNumber] = pendingAdd; |
148 | while (m_pendingAdds.TryDequeue(out pendingAdd)) | ||
149 | { | ||
150 | if (pendingAdd != null && m_packets != null) | ||
151 | { | ||
152 | m_packets[pendingAdd.SequenceNumber] = pendingAdd; | ||
153 | } | ||
154 | } | ||
155 | } | ||
156 | 147 | ||
157 | // Process all the pending removes, including updating statistics and round-trip times | 148 | // Process all the pending removes, including updating statistics and round-trip times |
158 | PendingAck pendingRemove; | 149 | PendingAck pendingRemove; |
159 | OutgoingPacket ackedPacket; | 150 | OutgoingPacket ackedPacket; |
160 | if (m_pendingRemoves != null) | 151 | while (m_pendingRemoves.TryDequeue(out pendingRemove)) |
161 | { | 152 | { |
162 | while (m_pendingRemoves.TryDequeue(out pendingRemove)) | 153 | if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) |
163 | { | 154 | { |
164 | if (m_pendingRemoves != null && m_packets != null) | 155 | m_packets.Remove(pendingRemove.SequenceNumber); |
156 | |||
157 | // Update stats | ||
158 | Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); | ||
159 | |||
160 | if (!pendingRemove.FromResend) | ||
165 | { | 161 | { |
166 | if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) | 162 | // Calculate the round-trip time for this packet and its ACK |
167 | { | 163 | int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; |
168 | m_packets.Remove(pendingRemove.SequenceNumber); | 164 | if (rtt > 0) |
169 | 165 | ackedPacket.Client.UpdateRoundTrip(rtt); | |
170 | // Update stats | ||
171 | Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); | ||
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 | } | ||
181 | } | 166 | } |
182 | } | 167 | } |
183 | } | 168 | } |
184 | } | 169 | } |
185 | } | 170 | } |
186 | } | 171 | } \ No newline at end of file |