aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs48
1 files changed, 41 insertions, 7 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 7820caf..df4bbb3 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -171,6 +171,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
171 protected bool m_sendPing; 171 protected bool m_sendPing;
172 172
173 private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); 173 private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
174 private Pool<IncomingPacket> m_incomingPacketPool;
174 175
175 private int m_defaultRTO = 0; 176 private int m_defaultRTO = 0;
176 private int m_maxRTO = 0; 177 private int m_maxRTO = 0;
@@ -278,6 +279,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
278 279
279 m_throttle = new TokenBucket(null, sceneThrottleBps); 280 m_throttle = new TokenBucket(null, sceneThrottleBps);
280 ThrottleRates = new ThrottleRates(configSource); 281 ThrottleRates = new ThrottleRates(configSource);
282
283 if (UsePools)
284 m_incomingPacketPool = new Pool<IncomingPacket>(() => new IncomingPacket(), 500);
281 } 285 }
282 286
283 public void Start() 287 public void Start()
@@ -313,7 +317,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
313 317
314 base.StartOutbound(); 318 base.StartOutbound();
315 319
316 // This thread will process the packets received that are placed on the packetInbox
317 Watchdog.StartThread( 320 Watchdog.StartThread(
318 OutgoingPacketHandler, 321 OutgoingPacketHandler,
319 string.Format("Outgoing Packets ({0})", m_scene.RegionInfo.RegionName), 322 string.Format("Outgoing Packets ({0})", m_scene.RegionInfo.RegionName),
@@ -957,6 +960,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
957 // Handle appended ACKs 960 // Handle appended ACKs
958 if (packet.Header.AppendedAcks && packet.Header.AckList != null) 961 if (packet.Header.AppendedAcks && packet.Header.AckList != null)
959 { 962 {
963// m_log.DebugFormat(
964// "[LLUDPSERVER]: Handling {0} appended acks from {1} in {2}",
965// packet.Header.AckList.Length, client.Name, m_scene.Name);
966
960 for (int i = 0; i < packet.Header.AckList.Length; i++) 967 for (int i = 0; i < packet.Header.AckList.Length; i++)
961 udpClient.NeedAcks.Acknowledge(packet.Header.AckList[i], now, packet.Header.Resent); 968 udpClient.NeedAcks.Acknowledge(packet.Header.AckList[i], now, packet.Header.Resent);
962 } 969 }
@@ -966,6 +973,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
966 { 973 {
967 PacketAckPacket ackPacket = (PacketAckPacket)packet; 974 PacketAckPacket ackPacket = (PacketAckPacket)packet;
968 975
976// m_log.DebugFormat(
977// "[LLUDPSERVER]: Handling {0} packet acks for {1} in {2}",
978// ackPacket.Packets.Length, client.Name, m_scene.Name);
979
969 for (int i = 0; i < ackPacket.Packets.Length; i++) 980 for (int i = 0; i < ackPacket.Packets.Length; i++)
970 udpClient.NeedAcks.Acknowledge(ackPacket.Packets[i].ID, now, packet.Header.Resent); 981 udpClient.NeedAcks.Acknowledge(ackPacket.Packets[i].ID, now, packet.Header.Resent);
971 982
@@ -979,6 +990,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
979 990
980 if (packet.Header.Reliable) 991 if (packet.Header.Reliable)
981 { 992 {
993// m_log.DebugFormat(
994// "[LLUDPSERVER]: Adding ack request for {0} {1} from {2} in {3}",
995// packet.Type, packet.Header.Sequence, client.Name, m_scene.Name);
996
982 udpClient.PendingAcks.Enqueue(packet.Header.Sequence); 997 udpClient.PendingAcks.Enqueue(packet.Header.Sequence);
983 998
984 // This is a somewhat odd sequence of steps to pull the client.BytesSinceLastACK value out, 999 // This is a somewhat odd sequence of steps to pull the client.BytesSinceLastACK value out,
@@ -1025,6 +1040,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1025 1040
1026 if (packet.Type == PacketType.StartPingCheck) 1041 if (packet.Type == PacketType.StartPingCheck)
1027 { 1042 {
1043// m_log.DebugFormat("[LLUDPSERVER]: Handling ping from {0} in {1}", client.Name, m_scene.Name);
1044
1028 // We don't need to do anything else with ping checks 1045 // We don't need to do anything else with ping checks
1029 StartPingCheckPacket startPing = (StartPingCheckPacket)packet; 1046 StartPingCheckPacket startPing = (StartPingCheckPacket)packet;
1030 CompletePing(udpClient, startPing.PingID.PingID); 1047 CompletePing(udpClient, startPing.PingID.PingID);
@@ -1044,13 +1061,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1044 1061
1045 #endregion Ping Check Handling 1062 #endregion Ping Check Handling
1046 1063
1064 IncomingPacket incomingPacket;
1065
1047 // Inbox insertion 1066 // Inbox insertion
1048 if (packet.Type == PacketType.AgentUpdate || 1067 if (UsePools)
1049 packet.Type == PacketType.ChatFromViewer) 1068 {
1050 packetInbox.EnqueueHigh(new IncomingPacket((LLClientView)client, packet)); 1069 incomingPacket = m_incomingPacketPool.GetObject();
1070 incomingPacket.Client = (LLClientView)client;
1071 incomingPacket.Packet = packet;
1072 }
1051 else 1073 else
1052 packetInbox.EnqueueLow(new IncomingPacket((LLClientView)client, packet)); 1074 {
1053// packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); 1075 incomingPacket = new IncomingPacket((LLClientView)client, packet);
1076 }
1077
1078 if (incomingPacket.Packet.Type == PacketType.AgentUpdate ||
1079 incomingPacket.Packet.Type == PacketType.ChatFromViewer)
1080 packetInbox.EnqueueHigh(incomingPacket);
1081 else
1082 packetInbox.EnqueueLow(incomingPacket);
1054 } 1083 }
1055 1084
1056 #region BinaryStats 1085 #region BinaryStats
@@ -1333,7 +1362,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1333 // on to en-US to avoid number parsing issues 1362 // on to en-US to avoid number parsing issues
1334 Culture.SetCurrentCulture(); 1363 Culture.SetCurrentCulture();
1335 1364
1336 while (base.IsRunningInbound) 1365 while (IsRunningInbound)
1337 { 1366 {
1338 m_scene.ThreadAlive(1); 1367 m_scene.ThreadAlive(1);
1339 try 1368 try
@@ -1349,7 +1378,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1349 } 1378 }
1350 1379
1351 if (packetInbox.Dequeue(100, ref incomingPacket)) 1380 if (packetInbox.Dequeue(100, ref incomingPacket))
1381 {
1352 ProcessInPacket(incomingPacket);//, incomingPacket); Util.FireAndForget(ProcessInPacket, incomingPacket); 1382 ProcessInPacket(incomingPacket);//, incomingPacket); Util.FireAndForget(ProcessInPacket, incomingPacket);
1383
1384 if (UsePools)
1385 m_incomingPacketPool.ReturnObject(incomingPacket);
1386 }
1353 } 1387 }
1354 catch (Exception ex) 1388 catch (Exception ex)
1355 { 1389 {