aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs55
1 files changed, 38 insertions, 17 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 7a403aa..66e1468 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -572,6 +572,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
572 for (int i = 0; i < ackPacket.Packets.Length; i++) 572 for (int i = 0; i < ackPacket.Packets.Length; i++)
573 AcknowledgePacket(udpClient, ackPacket.Packets[i].ID, now, packet.Header.Resent); 573 AcknowledgePacket(udpClient, ackPacket.Packets[i].ID, now, packet.Header.Resent);
574 } 574 }
575
576 // We don't need to do anything else with PacketAck packets
577 return;
575 } 578 }
576 579
577 #endregion ACK Receiving 580 #endregion ACK Receiving
@@ -579,20 +582,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
579 #region ACK Sending 582 #region ACK Sending
580 583
581 if (packet.Header.Reliable) 584 if (packet.Header.Reliable)
585 {
582 udpClient.PendingAcks.Enqueue(packet.Header.Sequence); 586 udpClient.PendingAcks.Enqueue(packet.Header.Sequence);
583 587
584 // This is a somewhat odd sequence of steps to pull the client.BytesSinceLastACK value out, 588 // This is a somewhat odd sequence of steps to pull the client.BytesSinceLastACK value out,
585 // add the current received bytes to it, test if 2*MTU bytes have been sent, if so remove 589 // add the current received bytes to it, test if 2*MTU bytes have been sent, if so remove
586 // 2*MTU bytes from the value and send ACKs, and finally add the local value back to 590 // 2*MTU bytes from the value and send ACKs, and finally add the local value back to
587 // client.BytesSinceLastACK. Lockless thread safety 591 // client.BytesSinceLastACK. Lockless thread safety
588 int bytesSinceLastACK = Interlocked.Exchange(ref udpClient.BytesSinceLastACK, 0); 592 int bytesSinceLastACK = Interlocked.Exchange(ref udpClient.BytesSinceLastACK, 0);
589 bytesSinceLastACK += buffer.DataLength; 593 bytesSinceLastACK += buffer.DataLength;
590 if (bytesSinceLastACK > LLUDPServer.MTU * 2) 594 if (bytesSinceLastACK > LLUDPServer.MTU * 2)
591 { 595 {
592 bytesSinceLastACK -= LLUDPServer.MTU * 2; 596 bytesSinceLastACK -= LLUDPServer.MTU * 2;
593 SendAcks(udpClient); 597 SendAcks(udpClient);
598 }
599 Interlocked.Add(ref udpClient.BytesSinceLastACK, bytesSinceLastACK);
594 } 600 }
595 Interlocked.Add(ref udpClient.BytesSinceLastACK, bytesSinceLastACK);
596 601
597 #endregion ACK Sending 602 #endregion ACK Sending
598 603
@@ -612,12 +617,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
612 617
613 #endregion Incoming Packet Accounting 618 #endregion Incoming Packet Accounting
614 619
615 // Don't bother clogging up the queue with PacketAck packets that are already handled here 620 #region Ping Check Handling
616 if (packet.Type != PacketType.PacketAck) 621
622 if (packet.Type == PacketType.StartPingCheck)
623 {
624 // We don't need to do anything else with ping checks
625 StartPingCheckPacket startPing = (StartPingCheckPacket)packet;
626
627 CompletePingCheckPacket completePing = new CompletePingCheckPacket();
628 completePing.PingID.PingID = startPing.PingID.PingID;
629 SendPacket(udpClient, completePing, ThrottleOutPacketType.Unknown, false);
630 return;
631 }
632 else if (packet.Type == PacketType.CompletePingCheck)
617 { 633 {
618 // Inbox insertion 634 // We don't currently track client ping times
619 packetInbox.Enqueue(new IncomingPacket(udpClient, packet)); 635 return;
620 } 636 }
637
638 #endregion Ping Check Handling
639
640 // Inbox insertion
641 packetInbox.Enqueue(new IncomingPacket(udpClient, packet));
621 } 642 }
622 643
623 protected override void PacketSent(UDPPacketBuffer buffer, int bytesSent) 644 protected override void PacketSent(UDPPacketBuffer buffer, int bytesSent)
@@ -712,10 +733,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
712 // on to en-US to avoid number parsing issues 733 // on to en-US to avoid number parsing issues
713 Culture.SetCurrentCulture(); 734 Culture.SetCurrentCulture();
714 735
715 IncomingPacket incomingPacket = null;
716
717 while (base.IsRunning) 736 while (base.IsRunning)
718 { 737 {
738 IncomingPacket incomingPacket = null;
739
719 try 740 try
720 { 741 {
721 if (packetInbox.Dequeue(100, ref incomingPacket)) 742 if (packetInbox.Dequeue(100, ref incomingPacket))