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.
---
.../Modules/UserTextureDownloadService.cs | 36 +++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs')
diff --git a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
index 32bc7c3..4a94266 100644
--- a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
+++ b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
@@ -35,13 +35,27 @@ using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
+ ///
+ /// This module sets up texture senders in response to client texture requests, and places them on a
+ /// processing queue once those senders have the appropriate data (i.e. a texture retrieved from the
+ /// asset cache).
+ ///
public class UserTextureDownloadService
{
private static readonly log4net.ILog m_log
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ ///
+ /// Holds texture senders before they have received the appropriate texture from the asset cache.
+ ///
private readonly Dictionary m_textureSenders = new Dictionary();
+
+ ///
+ /// Texture Senders are placed in this queue once they have received their texture from the asset
+ /// cache. Another module actually invokes the send.
+ ///
private readonly BlockingQueue m_sharedSendersQueue;
+
private readonly Scene m_scene;
public UserTextureDownloadService(Scene scene, BlockingQueue sharedQueue)
@@ -50,6 +64,12 @@ namespace OpenSim.Region.Environment.Modules
m_sharedSendersQueue = sharedQueue;
}
+ ///
+ /// Handle a texture request. This involves creating a texture sender and placing it on the
+ /// previously passed in shared queue.
+ ///
+ ///
+ ///
public void HandleTextureRequest(IClientAPI client, TextureRequestArgs e)
{
TextureSender textureSender;
@@ -72,8 +92,9 @@ namespace OpenSim.Region.Environment.Modules
else
{
TextureSender requestHandler =
- new TextureSender(client, e.RequestedAssetID, e.DiscardLevel, e.PacketNumber);
+ new TextureSender(client, e.DiscardLevel, e.PacketNumber);
m_textureSenders.Add(e.RequestedAssetID, requestHandler);
+
m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback);
}
}
@@ -90,6 +111,12 @@ namespace OpenSim.Region.Environment.Modules
}
}
+ ///
+ /// The callback for the asset cache when a texture has been retrieved. This method queues the
+ /// texture sender for processing.
+ ///
+ ///
+ ///
public void TextureCallback(LLUUID textureID, AssetBase asset)
{
lock (m_textureSenders)
@@ -115,6 +142,10 @@ namespace OpenSim.Region.Environment.Modules
}
}
+ ///
+ /// Place a ready texture sender on the processing queue.
+ ///
+ ///
private void EnqueueTextureSender(TextureSender textureSender)
{
textureSender.Cancel = false;
@@ -127,6 +158,9 @@ namespace OpenSim.Region.Environment.Modules
}
}
+ ///
+ /// Close this module.
+ ///
internal void Close()
{
lock (m_textureSenders)
--
cgit v1.1