From 4a29a7f92cc5264dfcb4a4376a61506d29dd9d8d Mon Sep 17 00:00:00 2001 From: CasperW Date: Sat, 21 Nov 2009 18:50:52 +0100 Subject: [PATCH] Minor packet ordering fix --- .../ClientStack/LindenUDP/LLUDPServer.cs | 1 - .../ClientStack/LindenUDP/OpenSimUDPBase.cs | 40 ++++++++++++++----- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 4a7bdfe92b..98bb4f7b41 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -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 diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs index 45d9170a09..de2cd242c9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs @@ -57,7 +57,12 @@ namespace OpenMetaverse /// Standard queue for our outgoing SyncBeginPrioritySend /// private List m_standardQueue = new List(); - + + /// + /// Medium priority queue for our outgoing SyncBeginPrioritySend + /// + private List m_mediumPriorityQueue = new List(); + /// /// Prioritised queue for our outgoing SyncBeginPrioritySend /// @@ -285,13 +290,16 @@ namespace OpenMetaverse } 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); } @@ -339,17 +347,29 @@ namespace OpenMetaverse } else { - lock (m_standardQueue) + lock (m_mediumPriorityQueue) { - if (m_standardQueue.Count > 0) + if (m_mediumPriorityQueue.Count > 0) { - UDPPacketBuffer buf = m_standardQueue[0]; - m_standardQueue.RemoveAt(0); + UDPPacketBuffer buf = m_mediumPriorityQueue[0]; + m_mediumPriorityQueue.RemoveAt(0); AsyncBeginSend(buf); } 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; + } + } } } }