aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
authorMelanie Thielker2008-08-07 14:48:45 +0000
committerMelanie Thielker2008-08-07 14:48:45 +0000
commit51f90af4b735efbe0c6bdccd93c887b266f91488 (patch)
tree9bf4a3463da24290eac50b1c1aa375a5a5790d30 /OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
parentMinor formatting cleanup. (diff)
downloadopensim-SC_OLD-51f90af4b735efbe0c6bdccd93c887b266f91488.zip
opensim-SC_OLD-51f90af4b735efbe0c6bdccd93c887b266f91488.tar.gz
opensim-SC_OLD-51f90af4b735efbe0c6bdccd93c887b266f91488.tar.bz2
opensim-SC_OLD-51f90af4b735efbe0c6bdccd93c887b266f91488.tar.xz
Patch #9158
Refactor packet sending into LLPacketHandler. Change packet sequencing and ack lists to ensure packet sequences conform to wire order.
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs52
1 files changed, 7 insertions, 45 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index ec945cd..a1e270b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -392,7 +392,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
392 // in it to process. It's an on-purpose threadlock though because 392 // in it to process. It's an on-purpose threadlock though because
393 // without it, the clientloop will suck up all sim resources. 393 // without it, the clientloop will suck up all sim resources.
394 394
395 m_PacketHandler = new LLPacketHandler(this); 395 m_PacketHandler = new LLPacketHandler(this, m_networkServer);
396 m_PacketHandler.SynchronizeClient = SynchronizeClient; 396 m_PacketHandler.SynchronizeClient = SynchronizeClient;
397 397
398 RegisterLocalPacketHandlers(); 398 RegisterLocalPacketHandlers();
@@ -616,12 +616,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
616 if (nextPacket.Incoming) 616 if (nextPacket.Incoming)
617 { 617 {
618 DebugPacket("IN", nextPacket.Packet); 618 DebugPacket("IN", nextPacket.Packet);
619 m_PacketHandler.ProcessInPacket(nextPacket.Packet); 619 m_PacketHandler.ProcessInPacket(nextPacket);
620 } 620 }
621 else 621 else
622 { 622 {
623 DebugPacket("OUT", nextPacket.Packet); 623 DebugPacket("OUT", nextPacket.Packet);
624 ProcessOutPacket(nextPacket.Packet); 624 m_PacketHandler.ProcessOutPacket(nextPacket);
625 } 625 }
626 } 626 }
627 } 627 }
@@ -745,7 +745,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
745 + "Any further actions taken will not be processed.\n" 745 + "Any further actions taken will not be processed.\n"
746 + "Please relog", true); 746 + "Please relog", true);
747 747
748 ProcessOutPacket(packet); 748 LLQueItem item = new LLQueItem();
749 item.Packet = packet;
750
751 m_PacketHandler.ProcessOutPacket(item);
749 752
750 // There may be a better way to do this. Perhaps kick? Not sure this propogates notifications to 753 // There may be a better way to do this. Perhaps kick? Not sure this propogates notifications to
751 // listeners yet, though. 754 // listeners yet, though.
@@ -3685,47 +3688,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3685 m_PacketHandler.PacketQueue.SetThrottleFromClient(throttles); 3688 m_PacketHandler.PacketQueue.SetThrottleFromClient(throttles);
3686 } 3689 }
3687 3690
3688 // Previously ClientView.m_packetQueue
3689
3690 /// <summary>
3691 /// Helper routine to prepare the packet for sending to UDP client
3692 /// This converts it to bytes and puts it on the outgoing buffer
3693 /// </summary>
3694 /// <param name="Pack"></param>
3695 protected virtual void ProcessOutPacket(Packet Pack)
3696 {
3697 // Keep track of when this packet was sent out
3698 Pack.TickCount = System.Environment.TickCount;
3699
3700 // Actually make the byte array and send it
3701 try
3702 {
3703 byte[] sendbuffer = Pack.ToBytes();
3704 PacketPool.Instance.ReturnPacket(Pack);
3705
3706 if (Pack.Header.Zerocoded)
3707 {
3708 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
3709 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);
3710 }
3711 else
3712 {
3713 //Need some extra space in case we need to add proxy information to the message later
3714 Buffer.BlockCopy(sendbuffer, 0, ZeroOutBuffer, 0, sendbuffer.Length);
3715 m_networkServer.SendPacketTo(ZeroOutBuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
3716 }
3717 }
3718 catch (Exception e)
3719 {
3720 m_log.Warn("[client]: " +
3721 "ClientView.m_packetQueue.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " +
3722 m_userEndPoint.ToString() + " - killing thread");
3723 m_log.Error(e.ToString());
3724 Close(true);
3725 }
3726 }
3727
3728 /// <summary>
3729 /// method gets called when a new packet has arrived from the UDP server. This happens after it's been decoded into a libsl object 3691 /// method gets called when a new packet has arrived from the UDP server. This happens after it's been decoded into a libsl object
3730 /// </summary> 3692 /// </summary>
3731 /// <param name="NewPack"></param> 3693 /// <param name="NewPack"></param>