From b4526a5a6d170e04655990c8edb8e355156a2061 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sun, 18 Oct 2009 02:00:42 -0700 Subject: * Big performance increase in loading prims from the region database with MySQL * Handle the AgentFOV packet * Bypass queuing and throttles for ping checks to make ping times more closely match network latency * Only track reliable bytes in LLUDPCLient.BytesSinceLastACK --- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 51 +++++++++++++++------- 1 file changed, 36 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 7a403aa..4f3478b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -572,6 +572,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < ackPacket.Packets.Length; i++) AcknowledgePacket(udpClient, ackPacket.Packets[i].ID, now, packet.Header.Resent); } + + // We don't need to do anything else with PacketAck packets + return; } #endregion ACK Receiving @@ -579,20 +582,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region ACK Sending if (packet.Header.Reliable) + { udpClient.PendingAcks.Enqueue(packet.Header.Sequence); - // This is a somewhat odd sequence of steps to pull the client.BytesSinceLastACK value out, - // add the current received bytes to it, test if 2*MTU bytes have been sent, if so remove - // 2*MTU bytes from the value and send ACKs, and finally add the local value back to - // client.BytesSinceLastACK. Lockless thread safety - int bytesSinceLastACK = Interlocked.Exchange(ref udpClient.BytesSinceLastACK, 0); - bytesSinceLastACK += buffer.DataLength; - if (bytesSinceLastACK > LLUDPServer.MTU * 2) - { - bytesSinceLastACK -= LLUDPServer.MTU * 2; - SendAcks(udpClient); + // This is a somewhat odd sequence of steps to pull the client.BytesSinceLastACK value out, + // add the current received bytes to it, test if 2*MTU bytes have been sent, if so remove + // 2*MTU bytes from the value and send ACKs, and finally add the local value back to + // client.BytesSinceLastACK. Lockless thread safety + int bytesSinceLastACK = Interlocked.Exchange(ref udpClient.BytesSinceLastACK, 0); + bytesSinceLastACK += buffer.DataLength; + if (bytesSinceLastACK > LLUDPServer.MTU * 2) + { + bytesSinceLastACK -= LLUDPServer.MTU * 2; + SendAcks(udpClient); + } + Interlocked.Add(ref udpClient.BytesSinceLastACK, bytesSinceLastACK); } - Interlocked.Add(ref udpClient.BytesSinceLastACK, bytesSinceLastACK); #endregion ACK Sending @@ -612,12 +617,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion Incoming Packet Accounting - // Don't bother clogging up the queue with PacketAck packets that are already handled here - if (packet.Type != PacketType.PacketAck) + #region Ping Check Handling + + if (packet.Type == PacketType.StartPingCheck) { - // Inbox insertion - packetInbox.Enqueue(new IncomingPacket(udpClient, packet)); + // We don't need to do anything else with ping checks + StartPingCheckPacket startPing = (StartPingCheckPacket)packet; + + CompletePingCheckPacket completePing = new CompletePingCheckPacket(); + completePing.PingID.PingID = startPing.PingID.PingID; + SendPacket(udpClient, completePing, ThrottleOutPacketType.Unknown, false); + return; } + else if (packet.Type == PacketType.CompletePingCheck) + { + // We don't currently track client ping times + return; + } + + #endregion Ping Check Handling + + // Inbox insertion + packetInbox.Enqueue(new IncomingPacket(udpClient, packet)); } protected override void PacketSent(UDPPacketBuffer buffer, int bytesSent) -- cgit v1.1