aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
authorUbitUmarov2018-01-22 17:09:38 +0000
committerUbitUmarov2018-01-22 17:09:38 +0000
commitd38161f83d08e8f36905faaec30fcb9bbce9a319 (patch)
tree124cba5c7363aebf02965fc0702133c4e81f6874 /OpenSim/Region/ClientStack/Linden
parentgive BlockingCollection more chances (diff)
downloadopensim-SC-d38161f83d08e8f36905faaec30fcb9bbce9a319.zip
opensim-SC-d38161f83d08e8f36905faaec30fcb9bbce9a319.tar.gz
opensim-SC-d38161f83d08e8f36905faaec30fcb9bbce9a319.tar.bz2
opensim-SC-d38161f83d08e8f36905faaec30fcb9bbce9a319.tar.xz
retire our BlockingQueue replaced by BlockingCollection and cross fingers
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs22
1 files changed, 12 insertions, 10 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 72b6116..58094d3 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Concurrent;
30using System.Diagnostics; 31using System.Diagnostics;
31using System.IO; 32using System.IO;
32using System.Net; 33using System.Net;
@@ -285,7 +286,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
285 /// <summary>Incoming packets that are awaiting handling</summary> 286 /// <summary>Incoming packets that are awaiting handling</summary>
286 //protected OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); 287 //protected OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>();
287 288
288 protected OpenSim.Framework.BlockingQueue<IncomingPacket> packetInbox = new OpenSim.Framework.BlockingQueue<IncomingPacket>(); 289 protected BlockingCollection<IncomingPacket> packetInbox = new BlockingCollection<IncomingPacket>();
289 290
290 /// <summary>Bandwidth throttle for this UDP server</summary> 291 /// <summary>Bandwidth throttle for this UDP server</summary>
291 public TokenBucket Throttle { get; protected set; } 292 public TokenBucket Throttle { get; protected set; }
@@ -712,7 +713,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
712 scene.Name, 713 scene.Name,
713 StatType.Pull, 714 StatType.Pull,
714 MeasuresOfInterest.AverageChangeOverTime, 715 MeasuresOfInterest.AverageChangeOverTime,
715 stat => stat.Value = packetInbox.Count(), 716 stat => stat.Value = packetInbox.Count,
716 StatVerbosity.Debug)); 717 StatVerbosity.Debug));
717 718
718 // XXX: These stats are also pool stats but we register them separately since they are currently not 719 // XXX: These stats are also pool stats but we register them separately since they are currently not
@@ -1546,10 +1547,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1546 1547
1547// if (incomingPacket.Packet.Type == PacketType.AgentUpdate || 1548// if (incomingPacket.Packet.Type == PacketType.AgentUpdate ||
1548// incomingPacket.Packet.Type == PacketType.ChatFromViewer) 1549// incomingPacket.Packet.Type == PacketType.ChatFromViewer)
1549 if (incomingPacket.Packet.Type == PacketType.ChatFromViewer) 1550// if (incomingPacket.Packet.Type == PacketType.ChatFromViewer)
1550 packetInbox.PriorityEnqueue(incomingPacket); 1551// packetInbox.PriorityEnqueue(incomingPacket);
1551 else 1552// else
1552 packetInbox.Enqueue(incomingPacket); 1553// packetInbox.Enqueue(incomingPacket);
1554 packetInbox.Add(incomingPacket);
1553 1555
1554 } 1556 }
1555 1557
@@ -2018,7 +2020,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2018 Scene.ThreadAlive(1); 2020 Scene.ThreadAlive(1);
2019 try 2021 try
2020 { 2022 {
2021 incomingPacket = packetInbox.Dequeue(250); 2023 packetInbox.TryTake(out incomingPacket, 250);
2022 2024
2023 if (incomingPacket != null && IsRunningInbound) 2025 if (incomingPacket != null && IsRunningInbound)
2024 { 2026 {
@@ -2040,9 +2042,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2040 Watchdog.UpdateThread(); 2042 Watchdog.UpdateThread();
2041 } 2043 }
2042 2044
2043 if (packetInbox.Count() > 0) 2045 if (packetInbox.Count > 0)
2044 m_log.Warn("[LLUDPSERVER]: IncomingPacketHandler is shutting down, dropping " + packetInbox.Count() + " packets"); 2046 m_log.Warn("[LLUDPSERVER]: IncomingPacketHandler is shutting down, dropping " + packetInbox.Count + " packets");
2045 packetInbox.Clear(); 2047 packetInbox.Dispose();
2046 2048
2047 Watchdog.RemoveThread(); 2049 Watchdog.RemoveThread();
2048 } 2050 }