aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs34
1 files changed, 19 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index b575ed9..552c51e 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 => {try{stat.Value = packetInbox.Count;}catch{}},
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
@@ -898,7 +899,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
898 if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting) 899 if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting)
899 allowSplitting = false; 900 allowSplitting = false;
900 901
901 bool packetQueued = false; 902// bool packetQueued = false;
902 903
903 if (allowSplitting && packet.HasVariableBlocks) 904 if (allowSplitting && packet.HasVariableBlocks)
904 { 905 {
@@ -911,15 +912,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
911 for (int i = 0; i < packetCount; i++) 912 for (int i = 0; i < packetCount; i++)
912 { 913 {
913 byte[] data = datas[i]; 914 byte[] data = datas[i];
914 if (!SendPacketData(udpClient, data, packet.Type, category, method)) 915// if (!SendPacketData(udpClient, data, packet.Type, category, method))
915 packetQueued = true; 916// packetQueued = true;
917 SendPacketData(udpClient, data, packet.Type, category, method);
916 } 918 }
917 } 919 }
918 else 920 else
919 { 921 {
920 byte[] data = packet.ToBytes(); 922 byte[] data = packet.ToBytes();
921 if (!SendPacketData(udpClient, data, packet.Type, category, method)) 923// if (!SendPacketData(udpClient, data, packet.Type, category, method))
922 packetQueued = true; 924// packetQueued = true;
925 SendPacketData(udpClient, data, packet.Type, category, method);
923 } 926 }
924 927
925 PacketPool.Instance.ReturnPacket(packet); 928 PacketPool.Instance.ReturnPacket(packet);
@@ -1544,10 +1547,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1544 1547
1545// if (incomingPacket.Packet.Type == PacketType.AgentUpdate || 1548// if (incomingPacket.Packet.Type == PacketType.AgentUpdate ||
1546// incomingPacket.Packet.Type == PacketType.ChatFromViewer) 1549// incomingPacket.Packet.Type == PacketType.ChatFromViewer)
1547 if (incomingPacket.Packet.Type == PacketType.ChatFromViewer) 1550// if (incomingPacket.Packet.Type == PacketType.ChatFromViewer)
1548 packetInbox.PriorityEnqueue(incomingPacket); 1551// packetInbox.PriorityEnqueue(incomingPacket);
1549 else 1552// else
1550 packetInbox.Enqueue(incomingPacket); 1553// packetInbox.Enqueue(incomingPacket);
1554 packetInbox.Add(incomingPacket);
1551 1555
1552 } 1556 }
1553 1557
@@ -2016,7 +2020,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2016 Scene.ThreadAlive(1); 2020 Scene.ThreadAlive(1);
2017 try 2021 try
2018 { 2022 {
2019 incomingPacket = packetInbox.Dequeue(250); 2023 packetInbox.TryTake(out incomingPacket, 250);
2020 2024
2021 if (incomingPacket != null && IsRunningInbound) 2025 if (incomingPacket != null && IsRunningInbound)
2022 { 2026 {
@@ -2038,9 +2042,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2038 Watchdog.UpdateThread(); 2042 Watchdog.UpdateThread();
2039 } 2043 }
2040 2044
2041 if (packetInbox.Count() > 0) 2045 if (packetInbox.Count > 0)
2042 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");
2043 packetInbox.Clear(); 2047 packetInbox.Dispose();
2044 2048
2045 Watchdog.RemoveThread(); 2049 Watchdog.RemoveThread();
2046 } 2050 }