From 48e085c77451643cb7d819fc8c743a863b645a40 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 19 Feb 2008 23:42:30 +0000 Subject: * Add documentation * The reason why pending downloads tick ever upwards is because missing assets are never signalled to the TextureSender * Rectifying this is not straightfoward, but this will constitute the next patch. * This does not explain the memory leak. --- .../Region/Environment/Modules/TextureSender.cs | 58 ++++++++++++++++++---- 1 file changed, 47 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/TextureSender.cs') diff --git a/OpenSim/Region/Environment/Modules/TextureSender.cs b/OpenSim/Region/Environment/Modules/TextureSender.cs index 08da591..f2b3173 100644 --- a/OpenSim/Region/Environment/Modules/TextureSender.cs +++ b/OpenSim/Region/Environment/Modules/TextureSender.cs @@ -34,36 +34,59 @@ using OpenSim.Framework.Console; namespace OpenSim.Region.Environment.Modules { + /// + /// A TextureSender handles the process of receiving a texture requested by the client from the + /// AssetCache, and then sending that texture back to the client. + /// public class TextureSender { private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// + /// Records the number of times texture send has been called. + /// public int counter = 0; + + /// + /// Holds the texture asset to send. + /// private AssetBase m_asset; - public long DataPointer = 0; - public int NumPackets = 0; - public int PacketCounter = 0; + + /// + /// This is actually the number of extra packets required to send the texture data! We always assume + /// at least one is required. + /// + private int NumPackets = 0; + + /// + /// Holds the packet number to send next. In this case, each packet is 1000 bytes long and starts + /// at the 600th byte (0th indexed). + /// + private int PacketCounter = 0; + public bool Cancel = false; public bool ImageLoaded = false; - public bool Sending = false; - public IClientAPI RequestUser; - public LLUUID RequestedAssetID; - public int RequestedDiscardLevel = -1; - public uint StartPacketNumber = 0; + private IClientAPI RequestUser; - // private int m_sentDiscardLevel = -1; + private int RequestedDiscardLevel = -1; + private uint StartPacketNumber = 0; - public TextureSender(IClientAPI client, LLUUID textureID, int discardLevel, uint packetNumber) + public TextureSender(IClientAPI client, int discardLevel, uint packetNumber) { RequestUser = client; - RequestedAssetID = textureID; RequestedDiscardLevel = discardLevel; StartPacketNumber = packetNumber; } + /// + /// Load up the texture data to send. + /// + /// + /// A + /// public void TextureReceived(AssetBase asset) { m_asset = asset; @@ -79,6 +102,10 @@ namespace OpenSim.Region.Environment.Modules PacketCounter = (int) StartPacketNumber; } + /// + /// Send a texture packet to the client. + /// + /// True if the last packet has been sent, false otherwise. public bool SendTexturePacket() { SendPacket(); @@ -91,6 +118,9 @@ namespace OpenSim.Region.Environment.Modules return false; } + /// + /// Sends a texture packet to the client. + /// private void SendPacket() { if (PacketCounter <= NumPackets) @@ -148,6 +178,12 @@ namespace OpenSim.Region.Environment.Modules } } + /// + /// Calculate the number of packets that will be required to send the texture loaded into this sender + /// This is actually the number of 1000 byte packets not including an initial 600 byte packet... + /// + /// + /// private int CalculateNumPackets(int length) { int numPackets = 0; -- cgit v1.1