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 SyncBeginPrioritySend(buffer, 2); // highest priority
} }
else if (outgoingPacket.Type == PacketType.ObjectUpdate else if (outgoingPacket.Type == PacketType.ObjectUpdate
|| outgoingPacket.Type == PacketType.ChatFromSimulator
|| outgoingPacket.Type == PacketType.LayerData) || outgoingPacket.Type == PacketType.LayerData)
{ {
SyncBeginPrioritySend(buffer, 1); // medium priority SyncBeginPrioritySend(buffer, 1); // medium priority

View File

@ -58,6 +58,11 @@ namespace OpenMetaverse
/// </summary> /// </summary>
private List<UDPPacketBuffer> m_standardQueue = new List<UDPPacketBuffer>(); 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> /// <summary>
/// Prioritised queue for our outgoing SyncBeginPrioritySend /// Prioritised queue for our outgoing SyncBeginPrioritySend
/// </summary> /// </summary>
@ -285,13 +290,16 @@ namespace OpenMetaverse
} }
else else
{ {
lock (m_standardQueue) if (Priority != 0)
{ {
if (Priority != 0) lock (m_mediumPriorityQueue)
{ {
m_standardQueue.Insert(0, buf); m_mediumPriorityQueue.Add(buf);
} }
else }
else
{
lock (m_standardQueue)
{ {
m_standardQueue.Add(buf); m_standardQueue.Add(buf);
} }
@ -339,17 +347,29 @@ namespace OpenMetaverse
} }
else else
{ {
lock (m_standardQueue) lock (m_mediumPriorityQueue)
{ {
if (m_standardQueue.Count > 0) if (m_mediumPriorityQueue.Count > 0)
{ {
UDPPacketBuffer buf = m_standardQueue[0]; UDPPacketBuffer buf = m_mediumPriorityQueue[0];
m_standardQueue.RemoveAt(0); m_mediumPriorityQueue.RemoveAt(0);
AsyncBeginSend(buf); AsyncBeginSend(buf);
} }
else else
{ {
m_sendingData = false; lock (m_standardQueue)
{
if (m_standardQueue.Count > 0)
{
UDPPacketBuffer buf = m_standardQueue[0];
m_standardQueue.RemoveAt(0);
AsyncBeginSend(buf);
}
else
{
m_sendingData = false;
}
}
} }
} }
} }