issues with udp buffers pool on heavy load

This commit is contained in:
UbitUmarov
2019-02-26 15:02:57 +00:00
parent e24adb9ea1
commit 4de5e14e54
4 changed files with 53 additions and 42 deletions

View File

@@ -189,8 +189,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Process all the pending adds
OutgoingPacket pendingAdd;
while (m_pendingAdds.TryDequeue(out pendingAdd))
{
if (pendingAdd != null)
m_packets[pendingAdd.SequenceNumber] = pendingAdd;
}
// Process all the pending removes, including updating statistics and round-trip times
PendingAck pendingAcknowledgement;
@@ -203,15 +205,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (ackedPacket != null)
{
m_packets.Remove(pendingAcknowledgement.SequenceNumber);
// Update stats
Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
ackedPacket.Client.FreeUDPBuffer(ackedPacket.Buffer);
ackedPacket.Buffer = null;
// As with other network applications, assume that an acknowledged packet is an
// indication that the network can handle a little more load, speed up the transmission
ackedPacket.Client.FlowThrottle.AcknowledgePackets(1);
// Update stats
Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
if (!pendingAcknowledgement.FromResend)
{
// Calculate the round-trip time for this packet and its ACK
@@ -242,10 +246,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (removedPacket != null)
{
m_packets.Remove(pendingRemove);
removedPacket.Client.FreeUDPBuffer(removedPacket.Buffer);
// Update stats
Interlocked.Add(ref removedPacket.Client.UnackedBytes, -removedPacket.Buffer.DataLength);
removedPacket.Client.FreeUDPBuffer(removedPacket.Buffer);
removedPacket.Buffer = null;
}
}
}