aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs61
1 files changed, 35 insertions, 26 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
index cce3399..7a66925 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
@@ -98,8 +98,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
98 98
99 // A list of the packets we haven't acked yet 99 // A list of the packets we haven't acked yet
100 // 100 //
101 private Dictionary<uint,uint> m_PendingAcks = new Dictionary<uint,uint>(); 101 private Dictionary<uint, uint> m_PendingAcks = new Dictionary<uint, uint>();
102 102
103 // Dictionary of the packets that need acks from the client. 103 // Dictionary of the packets that need acks from the client.
104 // 104 //
105 private class AckData 105 private class AckData
@@ -117,7 +117,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
117 public int TickCount; 117 public int TickCount;
118 public int Resends; 118 public int Resends;
119 } 119 }
120 120
121 private Dictionary<uint, AckData> m_NeedAck = 121 private Dictionary<uint, AckData> m_NeedAck =
122 new Dictionary<uint, AckData>(); 122 new Dictionary<uint, AckData>();
123 123
@@ -234,6 +234,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
234 m_AckTimer.Stop(); 234 m_AckTimer.Stop();
235 235
236 m_PacketQueue.Enqueue(null); 236 m_PacketQueue.Enqueue(null);
237 m_PacketQueue.Close();
237 } 238 }
238 239
239 // Send one packet. This actually doesn't send anything, it queues 240 // Send one packet. This actually doesn't send anything, it queues
@@ -362,7 +363,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
362 if ((now - data.TickCount) > m_ResendTimeout) 363 if ((now - data.TickCount) > m_ResendTimeout)
363 { 364 {
364 m_NeedAck[packet.Header.Sequence].Resends++; 365 m_NeedAck[packet.Header.Sequence].Resends++;
365 366
366 // The client needs to be told that a packet is being resent, otherwise it appears to believe 367 // The client needs to be told that a packet is being resent, otherwise it appears to believe
367 // that it should reset its sequence to that packet number. 368 // that it should reset its sequence to that packet number.
368 packet.Header.Resent = true; 369 packet.Header.Resent = true;
@@ -767,33 +768,41 @@ namespace OpenSim.Region.ClientStack.LindenUDP
767 768
768 // If we sent a killpacket 769 // If we sent a killpacket
769 if (packet is KillPacket) 770 if (packet is KillPacket)
770 Thread.CurrentThread.Abort(); 771 {
772 Abort();
771 773
772 // Actually make the byte array and send it 774 // Actually make the byte array and send it
773 byte[] sendbuffer = packet.ToBytes(); 775 byte[] sendbuffer = packet.ToBytes();
774 776
775 //m_log.DebugFormat( 777 //m_log.DebugFormat(
776 // "[CLIENT]: In {0} sending packet {1}", 778 // "[CLIENT]: In {0} sending packet {1}",
777 // m_Client.Scene.RegionInfo.ExternalEndPoint.Port, packet.Header.Sequence); 779 // m_Client.Scene.RegionInfo.ExternalEndPoint.Port, packet.Header.Sequence);
778 780
779 if (packet.Header.Zerocoded) 781 if (packet.Header.Zerocoded)
780 { 782 {
781 int packetsize = Helpers.ZeroEncode(sendbuffer, 783 int packetsize = Helpers.ZeroEncode(sendbuffer,
782 sendbuffer.Length, m_ZeroOutBuffer); 784 sendbuffer.Length, m_ZeroOutBuffer);
783 m_PacketServer.SendPacketTo(m_ZeroOutBuffer, packetsize, 785 m_PacketServer.SendPacketTo(m_ZeroOutBuffer, packetsize,
784 SocketFlags.None, m_Client.CircuitCode); 786 SocketFlags.None, m_Client.CircuitCode);
785 } 787 }
786 else 788 else
787 { 789 {
788 // Need some extra space in case we need to add proxy 790 // Need some extra space in case we need to add proxy
789 // information to the message later 791 // information to the message later
790 Buffer.BlockCopy(sendbuffer, 0, m_ZeroOutBuffer, 0, 792 Buffer.BlockCopy(sendbuffer, 0, m_ZeroOutBuffer, 0,
791 sendbuffer.Length); 793 sendbuffer.Length);
792 m_PacketServer.SendPacketTo(m_ZeroOutBuffer, 794 m_PacketServer.SendPacketTo(m_ZeroOutBuffer,
793 sendbuffer.Length, SocketFlags.None, m_Client.CircuitCode); 795 sendbuffer.Length, SocketFlags.None, m_Client.CircuitCode);
796 }
797
798 PacketPool.Instance.ReturnPacket(packet);
794 } 799 }
800 }
795 801
796 PacketPool.Instance.ReturnPacket(packet); 802 private void Abort()
803 {
804 m_PacketQueue.Close();
805 Thread.CurrentThread.Abort();
797 } 806 }
798 } 807 }
799} 808}