Hunting down mantis #5365
Revert "refactor: remove redundant null checks"
This reverts commit 6e58996b4d
.
0.7.1-dev
parent
98ea78fc77
commit
ebeef02fef
|
@ -141,28 +141,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
private void ProcessQueues()
|
private void ProcessQueues()
|
||||||
{
|
{
|
||||||
// Process all the pending adds
|
// Process all the pending adds
|
||||||
|
|
||||||
OutgoingPacket pendingAdd;
|
OutgoingPacket pendingAdd;
|
||||||
while (m_pendingAdds.TryDequeue(out pendingAdd))
|
if (m_pendingAdds != null)
|
||||||
m_packets[pendingAdd.SequenceNumber] = pendingAdd;
|
{
|
||||||
|
while (m_pendingAdds.TryDequeue(out pendingAdd))
|
||||||
|
{
|
||||||
|
if (pendingAdd != null && m_packets != null)
|
||||||
|
{
|
||||||
|
m_packets[pendingAdd.SequenceNumber] = pendingAdd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Process all the pending removes, including updating statistics and round-trip times
|
// Process all the pending removes, including updating statistics and round-trip times
|
||||||
PendingAck pendingRemove;
|
PendingAck pendingRemove;
|
||||||
OutgoingPacket ackedPacket;
|
OutgoingPacket ackedPacket;
|
||||||
while (m_pendingRemoves.TryDequeue(out pendingRemove))
|
if (m_pendingRemoves != null)
|
||||||
{
|
{
|
||||||
if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
|
while (m_pendingRemoves.TryDequeue(out pendingRemove))
|
||||||
{
|
{
|
||||||
m_packets.Remove(pendingRemove.SequenceNumber);
|
if (m_pendingRemoves != null && m_packets != null)
|
||||||
|
|
||||||
// Update stats
|
|
||||||
Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
|
|
||||||
|
|
||||||
if (!pendingRemove.FromResend)
|
|
||||||
{
|
{
|
||||||
// Calculate the round-trip time for this packet and its ACK
|
if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
|
||||||
int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
|
{
|
||||||
if (rtt > 0)
|
m_packets.Remove(pendingRemove.SequenceNumber);
|
||||||
ackedPacket.Client.UpdateRoundTrip(rtt);
|
|
||||||
|
// Update stats
|
||||||
|
Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
|
||||||
|
|
||||||
|
if (!pendingRemove.FromResend)
|
||||||
|
{
|
||||||
|
// Calculate the round-trip time for this packet and its ACK
|
||||||
|
int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
|
||||||
|
if (rtt > 0)
|
||||||
|
ackedPacket.Client.UpdateRoundTrip(rtt);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue