Recover from an internal mess-up in the outgoing packet queues by creating
a new queue object.avinationmerge
parent
ccba04f345
commit
b459239833
|
@ -498,7 +498,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
if (m_deliverPackets == false) return false;
|
if (m_deliverPackets == false) return false;
|
||||||
|
|
||||||
OutgoingPacket packet;
|
OutgoingPacket packet = null;
|
||||||
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue;
|
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue;
|
||||||
TokenBucket bucket;
|
TokenBucket bucket;
|
||||||
bool packetSent = false;
|
bool packetSent = false;
|
||||||
|
@ -530,32 +530,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// No dequeued packet waiting to be sent, try to pull one off
|
// No dequeued packet waiting to be sent, try to pull one off
|
||||||
// this queue
|
// this queue
|
||||||
queue = m_packetOutboxes[i];
|
queue = m_packetOutboxes[i];
|
||||||
if (queue != null && queue.Dequeue(out packet))
|
if (queue != null)
|
||||||
{
|
{
|
||||||
// A packet was pulled off the queue. See if we have
|
bool success = false;
|
||||||
// enough tokens in the bucket to send it out
|
try
|
||||||
if (bucket.RemoveTokens(packet.Buffer.DataLength))
|
|
||||||
{
|
{
|
||||||
// Send the packet
|
success = queue.Dequeue(out packet);
|
||||||
m_udpServer.SendPacketFinal(packet);
|
}
|
||||||
packetSent = true;
|
catch
|
||||||
|
{
|
||||||
|
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
|
||||||
|
}
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
// 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))
|
||||||
|
{
|
||||||
|
// Send the packet
|
||||||
|
m_udpServer.SendPacketFinal(packet);
|
||||||
|
packetSent = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Save the dequeued packet for the next iteration
|
||||||
|
m_nextPackets[i] = packet;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the queue is empty after this dequeue, fire the queue
|
||||||
|
// empty callback now so it has a chance to fill before we
|
||||||
|
// get back here
|
||||||
|
if (queue.Count == 0)
|
||||||
|
emptyCategories |= CategoryToFlag(i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Save the dequeued packet for the next iteration
|
// No packets in this queue. Fire the queue empty callback
|
||||||
m_nextPackets[i] = packet;
|
// if it has not been called recently
|
||||||
}
|
|
||||||
|
|
||||||
// If the queue is empty after this dequeue, fire the queue
|
|
||||||
// empty callback now so it has a chance to fill before we
|
|
||||||
// get back here
|
|
||||||
if (queue.Count == 0)
|
|
||||||
emptyCategories |= CategoryToFlag(i);
|
emptyCategories |= CategoryToFlag(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No packets in this queue. Fire the queue empty callback
|
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
|
||||||
// if it has not been called recently
|
|
||||||
emptyCategories |= CategoryToFlag(i);
|
emptyCategories |= CategoryToFlag(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -713,4 +730,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue