diff options
author | Diva Canto | 2011-02-07 07:45:03 -0800 |
---|---|---|
committer | Diva Canto | 2011-02-07 07:45:03 -0800 |
commit | ebeef02fef1a04b5b4cfe13dad588bcce7f9ba21 (patch) | |
tree | d1da2d558df448c4dd10f7c9c3bed851acd3dfb1 /OpenSim/Region/ClientStack/LindenUDP | |
parent | New command: show pending-objects (diff) | |
download | opensim-SC-ebeef02fef1a04b5b4cfe13dad588bcce7f9ba21.zip opensim-SC-ebeef02fef1a04b5b4cfe13dad588bcce7f9ba21.tar.gz opensim-SC-ebeef02fef1a04b5b4cfe13dad588bcce7f9ba21.tar.bz2 opensim-SC-ebeef02fef1a04b5b4cfe13dad588bcce7f9ba21.tar.xz |
Hunting down mantis #5365
Revert "refactor: remove redundant null checks"
This reverts commit 6e58996b4d9db202cd7795a37bd687362effef48.
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index 9d40688..d762bef 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs | |||
@@ -141,31 +141,46 @@ 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 | |||
144 | OutgoingPacket pendingAdd; | 145 | OutgoingPacket pendingAdd; |
145 | while (m_pendingAdds.TryDequeue(out pendingAdd)) | 146 | if (m_pendingAdds != null) |
146 | m_packets[pendingAdd.SequenceNumber] = pendingAdd; | 147 | { |
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 | } | ||
147 | 156 | ||
148 | // Process all the pending removes, including updating statistics and round-trip times | 157 | // Process all the pending removes, including updating statistics and round-trip times |
149 | PendingAck pendingRemove; | 158 | PendingAck pendingRemove; |
150 | OutgoingPacket ackedPacket; | 159 | OutgoingPacket ackedPacket; |
151 | while (m_pendingRemoves.TryDequeue(out pendingRemove)) | 160 | if (m_pendingRemoves != null) |
152 | { | 161 | { |
153 | if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) | 162 | while (m_pendingRemoves.TryDequeue(out pendingRemove)) |
154 | { | 163 | { |
155 | m_packets.Remove(pendingRemove.SequenceNumber); | 164 | if (m_pendingRemoves != null && m_packets != null) |
156 | |||
157 | // Update stats | ||
158 | Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); | ||
159 | |||
160 | if (!pendingRemove.FromResend) | ||
161 | { | 165 | { |
162 | // Calculate the round-trip time for this packet and its ACK | 166 | if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) |
163 | int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; | 167 | { |
164 | if (rtt > 0) | 168 | m_packets.Remove(pendingRemove.SequenceNumber); |
165 | ackedPacket.Client.UpdateRoundTrip(rtt); | 169 | |
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 | } | ||
166 | } | 181 | } |
167 | } | 182 | } |
168 | } | 183 | } |
169 | } | 184 | } |
170 | } | 185 | } |
171 | } \ No newline at end of file | 186 | } |