diff options
author | UbitUmarov | 2015-12-09 16:26:03 +0000 |
---|---|---|
committer | UbitUmarov | 2015-12-09 16:26:03 +0000 |
commit | 3ca4b6f319add01b4bcebaf31d1e8bb7e39cf75a (patch) | |
tree | 110155570684b9fb25a9698e4b1a316ab19abf7e /OpenSim | |
parent | fix the queue type in use (diff) | |
download | opensim-SC_OLD-3ca4b6f319add01b4bcebaf31d1e8bb7e39cf75a.zip opensim-SC_OLD-3ca4b6f319add01b4bcebaf31d1e8bb7e39cf75a.tar.gz opensim-SC_OLD-3ca4b6f319add01b4bcebaf31d1e8bb7e39cf75a.tar.bz2 opensim-SC_OLD-3ca4b6f319add01b4bcebaf31d1e8bb7e39cf75a.tar.xz |
fix the queue type in use
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 8f345e7..f8952b0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -286,7 +286,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
286 | /// <summary>Incoming packets that are awaiting handling</summary> | 286 | /// <summary>Incoming packets that are awaiting handling</summary> |
287 | //private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); | 287 | //private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); |
288 | 288 | ||
289 | private DoubleQueue<IncomingPacket> packetInbox = new DoubleQueue<IncomingPacket>(); | 289 | private OpenSim.Framework.BlockingQueue<IncomingPacket> packetInbox = new OpenSim.Framework.BlockingQueue<IncomingPacket>(); |
290 | 290 | ||
291 | /// <summary>Bandwidth throttle for this UDP server</summary> | 291 | /// <summary>Bandwidth throttle for this UDP server</summary> |
292 | public TokenBucket Throttle { get; private set; } | 292 | public TokenBucket Throttle { get; private set; } |
@@ -716,7 +716,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
716 | scene.Name, | 716 | scene.Name, |
717 | StatType.Pull, | 717 | StatType.Pull, |
718 | MeasuresOfInterest.AverageChangeOverTime, | 718 | MeasuresOfInterest.AverageChangeOverTime, |
719 | stat => stat.Value = packetInbox.Count, | 719 | stat => stat.Value = packetInbox.Count(), |
720 | StatVerbosity.Debug)); | 720 | StatVerbosity.Debug)); |
721 | 721 | ||
722 | // XXX: These stats are also pool stats but we register them separately since they are currently not | 722 | // XXX: These stats are also pool stats but we register them separately since they are currently not |
@@ -1552,9 +1552,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1552 | // if (incomingPacket.Packet.Type == PacketType.AgentUpdate || | 1552 | // if (incomingPacket.Packet.Type == PacketType.AgentUpdate || |
1553 | // incomingPacket.Packet.Type == PacketType.ChatFromViewer) | 1553 | // incomingPacket.Packet.Type == PacketType.ChatFromViewer) |
1554 | if (incomingPacket.Packet.Type == PacketType.ChatFromViewer) | 1554 | if (incomingPacket.Packet.Type == PacketType.ChatFromViewer) |
1555 | packetInbox.EnqueueHigh(incomingPacket); | 1555 | packetInbox.PriorityEnqueue(incomingPacket); |
1556 | else | 1556 | else |
1557 | packetInbox.EnqueueLow(incomingPacket); | 1557 | packetInbox.Enqueue(incomingPacket); |
1558 | 1558 | ||
1559 | } | 1559 | } |
1560 | 1560 | ||
@@ -2012,7 +2012,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2012 | private void IncomingPacketHandler() | 2012 | private void IncomingPacketHandler() |
2013 | { | 2013 | { |
2014 | Thread.CurrentThread.Priority = ThreadPriority.Highest; | 2014 | Thread.CurrentThread.Priority = ThreadPriority.Highest; |
2015 | 2015 | IncomingPacket incomingPacket; | |
2016 | // Set this culture for the thread that incoming packets are received | 2016 | // Set this culture for the thread that incoming packets are received |
2017 | // on to en-US to avoid number parsing issues | 2017 | // on to en-US to avoid number parsing issues |
2018 | Culture.SetCurrentCulture(); | 2018 | Culture.SetCurrentCulture(); |
@@ -2022,8 +2022,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2022 | Scene.ThreadAlive(1); | 2022 | Scene.ThreadAlive(1); |
2023 | try | 2023 | try |
2024 | { | 2024 | { |
2025 | IncomingPacket incomingPacket = null; | ||
2026 | |||
2027 | /* | 2025 | /* |
2028 | // HACK: This is a test to try and rate limit packet handling on Mono. | 2026 | // HACK: This is a test to try and rate limit packet handling on Mono. |
2029 | // If it works, a more elegant solution can be devised | 2027 | // If it works, a more elegant solution can be devised |
@@ -2033,14 +2031,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2033 | Thread.Sleep(30); | 2031 | Thread.Sleep(30); |
2034 | } | 2032 | } |
2035 | */ | 2033 | */ |
2036 | 2034 | incomingPacket = packetInbox.Dequeue(500); | |
2037 | if (packetInbox.Dequeue(100, ref incomingPacket)) | 2035 | |
2036 | if (incomingPacket != null) | ||
2038 | { | 2037 | { |
2039 | ProcessInPacket(incomingPacket);//, incomingPacket); Util.FireAndForget(ProcessInPacket, incomingPacket); | 2038 | ProcessInPacket(incomingPacket);//, incomingPacket); Util.FireAndForget(ProcessInPacket, incomingPacket); |
2040 | 2039 | ||
2041 | if (UsePools) | 2040 | if (UsePools) |
2042 | m_incomingPacketPool.ReturnObject(incomingPacket); | 2041 | m_incomingPacketPool.ReturnObject(incomingPacket); |
2043 | } | 2042 | } |
2043 | |||
2044 | incomingPacket = null; | ||
2044 | } | 2045 | } |
2045 | catch(Exception ex) | 2046 | catch(Exception ex) |
2046 | { | 2047 | { |
@@ -2050,8 +2051,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2050 | Watchdog.UpdateThread(); | 2051 | Watchdog.UpdateThread(); |
2051 | } | 2052 | } |
2052 | 2053 | ||
2053 | if (packetInbox.Count > 0) | 2054 | if (packetInbox.Count() > 0) |
2054 | m_log.Warn("[LLUDPSERVER]: IncomingPacketHandler is shutting down, dropping " + packetInbox.Count + " packets"); | 2055 | m_log.Warn("[LLUDPSERVER]: IncomingPacketHandler is shutting down, dropping " + packetInbox.Count() + " packets"); |
2055 | packetInbox.Clear(); | 2056 | packetInbox.Clear(); |
2056 | 2057 | ||
2057 | Watchdog.RemoveThread(); | 2058 | Watchdog.RemoveThread(); |