diff options
author | Teravus Ovares | 2008-06-28 00:33:17 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-06-28 00:33:17 +0000 |
commit | e5649e0dd5aa944e68594825399f71562d1c867e (patch) | |
tree | 5e577045e726afb9d68d68410b07e18ba6bfb864 /OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |
parent | altered prior warning fix to Meshmerizer.cs to allow mesh debugging code to f... (diff) | |
download | opensim-SC_OLD-e5649e0dd5aa944e68594825399f71562d1c867e.zip opensim-SC_OLD-e5649e0dd5aa944e68594825399f71562d1c867e.tar.gz opensim-SC_OLD-e5649e0dd5aa944e68594825399f71562d1c867e.tar.bz2 opensim-SC_OLD-e5649e0dd5aa944e68594825399f71562d1c867e.tar.xz |
* Various documentation to some black magic parts of LLClientView
* Added IClientAPI.SendTexture stub.
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 96 |
1 files changed, 90 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 08b93f3..0294ca7 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -47,7 +47,12 @@ using Timer=System.Timers.Timer; | |||
47 | namespace OpenSim.Region.ClientStack.LindenUDP | 47 | namespace OpenSim.Region.ClientStack.LindenUDP |
48 | { | 48 | { |
49 | public delegate bool PacketMethod(IClientAPI simClient, Packet packet); | 49 | public delegate bool PacketMethod(IClientAPI simClient, Packet packet); |
50 | |||
50 | 51 | ||
52 | /// <summary> | ||
53 | /// Class that keeps track of past packets so that they don't get | ||
54 | /// duplicated when the client doesn't get back an ack | ||
55 | /// </summary> | ||
51 | public class PacketDupeLimiter | 56 | public class PacketDupeLimiter |
52 | { | 57 | { |
53 | public PacketType pktype; | 58 | public PacketType pktype; |
@@ -88,6 +93,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
88 | 93 | ||
89 | private bool m_clientBlocked = false; | 94 | private bool m_clientBlocked = false; |
90 | 95 | ||
96 | // for sim stats | ||
91 | private int m_packetsReceived = 0; | 97 | private int m_packetsReceived = 0; |
92 | private int m_lastPacketsReceivedSentToScene = 0; | 98 | private int m_lastPacketsReceivedSentToScene = 0; |
93 | private int m_unAckedBytes = 0; | 99 | private int m_unAckedBytes = 0; |
@@ -645,6 +651,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
645 | 651 | ||
646 | # endregion | 652 | # endregion |
647 | 653 | ||
654 | /// <summary> | ||
655 | /// Event handler for check client timer | ||
656 | /// checks to ensure that the client is still connected | ||
657 | /// </summary> | ||
658 | /// <param name="sender"></param> | ||
659 | /// <param name="e"></param> | ||
648 | protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) | 660 | protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) |
649 | { | 661 | { |
650 | if (m_packetsReceived == m_lastPacketsReceived) | 662 | if (m_packetsReceived == m_lastPacketsReceived) |
@@ -675,6 +687,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
675 | 687 | ||
676 | # region Setup | 688 | # region Setup |
677 | 689 | ||
690 | /// <summary> | ||
691 | /// Starts up the timers to check the client and resend unacked packets | ||
692 | /// Adds the client to the OpenSim.Region.Environment.Scenes.Scene | ||
693 | /// </summary> | ||
678 | protected virtual void InitNewClient() | 694 | protected virtual void InitNewClient() |
679 | { | 695 | { |
680 | //this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); | 696 | //this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); |
@@ -3235,6 +3251,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3235 | 3251 | ||
3236 | #endregion | 3252 | #endregion |
3237 | 3253 | ||
3254 | /// <summary> | ||
3255 | /// This is a different way of processing packets then ProcessInPacket | ||
3256 | /// </summary> | ||
3238 | protected virtual void RegisterLocalPacketHandlers() | 3257 | protected virtual void RegisterLocalPacketHandlers() |
3239 | { | 3258 | { |
3240 | AddLocalPacketHandler(PacketType.LogoutRequest, Logout); | 3259 | AddLocalPacketHandler(PacketType.LogoutRequest, Logout); |
@@ -3663,11 +3682,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3663 | */ | 3682 | */ |
3664 | } | 3683 | } |
3665 | 3684 | ||
3685 | /// <summary> | ||
3686 | /// returns a byte array of the client set throttles Gets multiplied by the multiplier | ||
3687 | /// | ||
3688 | /// </summary> | ||
3689 | /// <param name="multiplier">non 1 multiplier for subdividing the throttles between individual regions</param> | ||
3690 | /// <returns></returns> | ||
3666 | public byte[] GetThrottlesPacked(float multiplier) | 3691 | public byte[] GetThrottlesPacked(float multiplier) |
3667 | { | 3692 | { |
3668 | return m_packetQueue.GetThrottlesPacked(multiplier); | 3693 | return m_packetQueue.GetThrottlesPacked(multiplier); |
3669 | } | 3694 | } |
3670 | 3695 | /// <summary> | |
3696 | /// sets the throttles from values supplied by the client | ||
3697 | /// </summary> | ||
3698 | /// <param name="throttles"></param> | ||
3671 | public void SetChildAgentThrottle(byte[] throttles) | 3699 | public void SetChildAgentThrottle(byte[] throttles) |
3672 | { | 3700 | { |
3673 | m_packetQueue.SetThrottleFromClient(throttles); | 3701 | m_packetQueue.SetThrottleFromClient(throttles); |
@@ -3723,10 +3751,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3723 | } | 3751 | } |
3724 | } | 3752 | } |
3725 | } | 3753 | } |
3726 | 3754 | /// <summary> | |
3755 | /// Append any ACKs that need to be sent out to this packet | ||
3756 | /// </summary> | ||
3757 | /// <param name="Pack"></param> | ||
3727 | protected virtual void SetPendingAcks(ref Packet Pack) | 3758 | protected virtual void SetPendingAcks(ref Packet Pack) |
3728 | { | 3759 | { |
3729 | // Append any ACKs that need to be sent out to this packet | 3760 | |
3730 | lock (m_pendingAcks) | 3761 | lock (m_pendingAcks) |
3731 | { | 3762 | { |
3732 | // TODO: If we are over MAX_APPENDED_ACKS we should drain off some of these | 3763 | // TODO: If we are over MAX_APPENDED_ACKS we should drain off some of these |
@@ -3747,6 +3778,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3747 | } | 3778 | } |
3748 | } | 3779 | } |
3749 | 3780 | ||
3781 | /// <summary> | ||
3782 | /// Helper routine to prepare the packet for sending to UDP client | ||
3783 | /// This converts it to bytes and puts it on the outgoing buffer | ||
3784 | /// </summary> | ||
3785 | /// <param name="Pack"></param> | ||
3750 | protected virtual void ProcessOutPacket(Packet Pack) | 3786 | protected virtual void ProcessOutPacket(Packet Pack) |
3751 | { | 3787 | { |
3752 | // Keep track of when this packet was sent out | 3788 | // Keep track of when this packet was sent out |
@@ -3795,6 +3831,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3795 | } | 3831 | } |
3796 | } | 3832 | } |
3797 | 3833 | ||
3834 | /// <summary> | ||
3835 | /// method gets called when a new packet has arrived from the UDP server. This happens after it's been decoded into a libsl object | ||
3836 | /// </summary> | ||
3837 | /// <param name="NewPack"></param> | ||
3798 | public virtual void InPacket(Packet NewPack) | 3838 | public virtual void InPacket(Packet NewPack) |
3799 | { | 3839 | { |
3800 | if (!m_packetProcessingEnabled && NewPack.Type != PacketType.LogoutRequest) | 3840 | if (!m_packetProcessingEnabled && NewPack.Type != PacketType.LogoutRequest) |
@@ -3859,7 +3899,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3859 | } | 3899 | } |
3860 | } | 3900 | } |
3861 | } | 3901 | } |
3862 | 3902 | ||
3903 | /// <summary> | ||
3904 | /// The dreaded OutPacket. This should only be called from withink the ClientStack itself right now | ||
3905 | /// This is the entry point for simulator packets to go out to the client. | ||
3906 | /// </summary> | ||
3907 | /// <param name="NewPack"></param> | ||
3908 | /// <param name="throttlePacketType">Corresponds to the type of data that is going out. Enum</param> | ||
3863 | public virtual void OutPacket(Packet NewPack, ThrottleOutPacketType throttlePacketType) | 3909 | public virtual void OutPacket(Packet NewPack, ThrottleOutPacketType throttlePacketType) |
3864 | { | 3910 | { |
3865 | if ((SynchronizeClient != null) && (!IsActive)) | 3911 | if ((SynchronizeClient != null) && (!IsActive)) |
@@ -3967,6 +4013,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3967 | SendPacketStats(); | 4013 | SendPacketStats(); |
3968 | } | 4014 | } |
3969 | 4015 | ||
4016 | /// <summary> | ||
4017 | /// Keeps track of the packet stats for the simulator stats reporter | ||
4018 | /// </summary> | ||
3970 | protected void SendPacketStats() | 4019 | protected void SendPacketStats() |
3971 | { | 4020 | { |
3972 | handlerPacketStats = OnPacketStats; | 4021 | handlerPacketStats = OnPacketStats; |
@@ -3978,6 +4027,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3978 | } | 4027 | } |
3979 | } | 4028 | } |
3980 | 4029 | ||
4030 | /// <summary> | ||
4031 | /// Emties out the old packets in the packet duplication tracking table. | ||
4032 | /// </summary> | ||
3981 | protected void ClearOldPacketDupeTracking() | 4033 | protected void ClearOldPacketDupeTracking() |
3982 | { | 4034 | { |
3983 | lock (m_dupeLimiter) | 4035 | lock (m_dupeLimiter) |
@@ -4004,7 +4056,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4004 | 4056 | ||
4005 | // remove the dupe packets that we detected in the loop above. | 4057 | // remove the dupe packets that we detected in the loop above. |
4006 | uint[] seqsToRemove = toEliminate.ToArray(); | 4058 | uint[] seqsToRemove = toEliminate.ToArray(); |
4007 | for (int i = 0; i<seqsToRemove.Length; i++) | 4059 | for (int i = 0; i < seqsToRemove.Length; i++) |
4008 | { | 4060 | { |
4009 | if (m_dupeLimiter.ContainsKey(seqsToRemove[i])) | 4061 | if (m_dupeLimiter.ContainsKey(seqsToRemove[i])) |
4010 | m_dupeLimiter.Remove(seqsToRemove[i]); | 4062 | m_dupeLimiter.Remove(seqsToRemove[i]); |
@@ -4037,6 +4089,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4037 | get { return m_packetProcessingEnabled; } | 4089 | get { return m_packetProcessingEnabled; } |
4038 | set { m_packetProcessingEnabled = value; } | 4090 | set { m_packetProcessingEnabled = value; } |
4039 | } | 4091 | } |
4092 | |||
4093 | /// <summary> | ||
4094 | /// Breaks down the genericMessagePacket into specific events | ||
4095 | /// </summary> | ||
4096 | /// <param name="gmMethod"></param> | ||
4097 | /// <param name="gmInvoice"></param> | ||
4098 | /// <param name="gmParams"></param> | ||
4040 | public void DecipherGenericMessage(string gmMethod, LLUUID gmInvoice, GenericMessagePacket.ParamListBlock[] gmParams) | 4099 | public void DecipherGenericMessage(string gmMethod, LLUUID gmInvoice, GenericMessagePacket.ParamListBlock[] gmParams) |
4041 | { | 4100 | { |
4042 | switch (gmMethod) | 4101 | switch (gmMethod) |
@@ -4081,9 +4140,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4081 | 4140 | ||
4082 | } | 4141 | } |
4083 | } | 4142 | } |
4143 | |||
4144 | /// <summary> | ||
4145 | /// Entryway from the client to the simulator | ||
4146 | /// all UDP packets from the client will end up here | ||
4147 | /// </summary> | ||
4148 | /// <param name="Pack">libsecondlife.packet</param> | ||
4084 | protected void ProcessInPacket(Packet Pack) | 4149 | protected void ProcessInPacket(Packet Pack) |
4085 | { | 4150 | { |
4151 | // always ack the packet! | ||
4086 | ack_pack(Pack); | 4152 | ack_pack(Pack); |
4153 | |||
4154 | // check for duplicate packets.. packets that the client is | ||
4155 | // resending because it didn't receive our ack | ||
4156 | |||
4087 | lock (m_dupeLimiter) | 4157 | lock (m_dupeLimiter) |
4088 | { | 4158 | { |
4089 | if (m_dupeLimiter.ContainsKey(Pack.Header.Sequence)) | 4159 | if (m_dupeLimiter.ContainsKey(Pack.Header.Sequence)) |
@@ -4100,7 +4170,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4100 | m_dupeLimiter.Add(Pack.Header.Sequence, pkdedupe); | 4170 | m_dupeLimiter.Add(Pack.Header.Sequence, pkdedupe); |
4101 | } | 4171 | } |
4102 | } | 4172 | } |
4103 | //m_log.Info("Sequence" | 4173 | |
4174 | // check if we've got a local packet handler for this packet.type. See RegisterLocalPacketHandlers() | ||
4104 | if (ProcessPacketMethod(Pack)) | 4175 | if (ProcessPacketMethod(Pack)) |
4105 | { | 4176 | { |
4106 | //there is a handler registered that handled this packet type | 4177 | //there is a handler registered that handled this packet type |
@@ -4108,6 +4179,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4108 | } | 4179 | } |
4109 | else | 4180 | else |
4110 | { | 4181 | { |
4182 | // Main packet processing conditional | ||
4111 | switch (Pack.Type) | 4183 | switch (Pack.Type) |
4112 | { | 4184 | { |
4113 | #region Scene/Avatar | 4185 | #region Scene/Avatar |
@@ -6159,6 +6231,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6159 | return shape; | 6231 | return shape; |
6160 | } | 6232 | } |
6161 | 6233 | ||
6234 | /// <summary> | ||
6235 | /// Send the client an Estate message blue box pop-down with a single OK button | ||
6236 | /// </summary> | ||
6237 | /// <param name="FromAvatarID"></param> | ||
6238 | /// <param name="fromSessionID"></param> | ||
6239 | /// <param name="FromAvatarName"></param> | ||
6240 | /// <param name="Message"></param> | ||
6162 | public void SendBlueBoxMessage(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message) | 6241 | public void SendBlueBoxMessage(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message) |
6163 | { | 6242 | { |
6164 | if (!ChildAgentStatus()) | 6243 | if (!ChildAgentStatus()) |
@@ -6387,6 +6466,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6387 | } | 6466 | } |
6388 | } | 6467 | } |
6389 | 6468 | ||
6469 | public void SendTexture(AssetBase TextureAsset) | ||
6470 | { | ||
6471 | |||
6472 | } | ||
6473 | |||
6390 | public ClientInfo GetClientInfo() | 6474 | public ClientInfo GetClientInfo() |
6391 | { | 6475 | { |
6392 | //MainLog.Instance.Verbose("CLIENT", "GetClientInfo BGN"); | 6476 | //MainLog.Instance.Verbose("CLIENT", "GetClientInfo BGN"); |