Minor packet ordering fix

avinationmerge
CasperW 2009-11-21 18:50:52 +01:00 committed by Melanie
parent 0149265ee8
commit 4a29a7f92c
2 changed files with 30 additions and 11 deletions

View File

@ -578,7 +578,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
SyncBeginPrioritySend(buffer, 2); // highest priority
}
else if (outgoingPacket.Type == PacketType.ObjectUpdate
|| outgoingPacket.Type == PacketType.ChatFromSimulator
|| outgoingPacket.Type == PacketType.LayerData)
{
SyncBeginPrioritySend(buffer, 1); // medium priority

View File

@ -58,6 +58,11 @@ namespace OpenMetaverse
/// </summary>
private List<UDPPacketBuffer> m_standardQueue = new List<UDPPacketBuffer>();
/// <summary>
/// Medium priority queue for our outgoing SyncBeginPrioritySend
/// </summary>
private List<UDPPacketBuffer> m_mediumPriorityQueue = new List<UDPPacketBuffer>();
/// <summary>
/// Prioritised queue for our outgoing SyncBeginPrioritySend
/// </summary>
@ -284,14 +289,17 @@ namespace OpenMetaverse
}
}
else
{
lock (m_standardQueue)
{
if (Priority != 0)
{
m_standardQueue.Insert(0, buf);
lock (m_mediumPriorityQueue)
{
m_mediumPriorityQueue.Add(buf);
}
}
else
{
lock (m_standardQueue)
{
m_standardQueue.Add(buf);
}
@ -338,6 +346,16 @@ namespace OpenMetaverse
AsyncBeginSend(buf);
}
else
{
lock (m_mediumPriorityQueue)
{
if (m_mediumPriorityQueue.Count > 0)
{
UDPPacketBuffer buf = m_mediumPriorityQueue[0];
m_mediumPriorityQueue.RemoveAt(0);
AsyncBeginSend(buf);
}
else
{
lock (m_standardQueue)
{
@ -356,6 +374,8 @@ namespace OpenMetaverse
}
}
}
}
}
catch (SocketException) { }
catch (ObjectDisposedException) { }
}