Recover from an internal mess-up in the outgoing packet queues by creating

a new queue object.
avinationmerge
Melanie 2011-12-08 01:08:40 +01:00
parent ccba04f345
commit b459239833
1 changed files with 36 additions and 19 deletions

View File

@ -498,7 +498,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (m_deliverPackets == false) return false;
OutgoingPacket packet;
OutgoingPacket packet = null;
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue;
TokenBucket bucket;
bool packetSent = false;
@ -530,7 +530,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// No dequeued packet waiting to be sent, try to pull one off
// this queue
queue = m_packetOutboxes[i];
if (queue != null && queue.Dequeue(out packet))
if (queue != null)
{
bool success = false;
try
{
success = queue.Dequeue(out packet);
}
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
@ -559,6 +570,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
emptyCategories |= CategoryToFlag(i);
}
}
else
{
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
emptyCategories |= CategoryToFlag(i);
}
}
}
if (emptyCategories != 0)