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

@@ -650,6 +650,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// leaving a dequeued packet still waiting to be sent out. Try to
// send it again
OutgoingPacket nextPacket = m_nextPackets[i];
if(nextPacket.Buffer == null)
{
if (m_packetOutboxes[i].Count < 5)
emptyCategories |= CategoryToFlag(i);
continue;
}
if (bucket.RemoveTokens(nextPacket.Buffer.DataLength))
{
// Send the packet
@@ -681,21 +687,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
// A packet was pulled off the queue. See if we have
// enough tokens in the bucket to send it out
if (bucket.RemoveTokens(packet.Buffer.DataLength))
if(packet.Buffer == null)
{
// Send the packet
m_udpServer.SendPacketFinal(packet);
packetSent = true;
// packet canceled elsewhere (by a ack for example)
if (queue.Count < 5)
emptyCategories |= CategoryToFlag(i);
}
else
{
// Save the dequeued packet for the next iteration
m_nextPackets[i] = packet;
}
if (bucket.RemoveTokens(packet.Buffer.DataLength))
{
// Send the packet
m_udpServer.SendPacketFinal(packet);
packetSent = true;
if (queue.Count < 5)
emptyCategories |= CategoryToFlag(i);
}
else
{
// Save the dequeued packet for the next iteration
m_nextPackets[i] = packet;
}
}
}
else
{