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. --- .../Environment/Modules/TextureDownloadModule.cs | 34 +++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/TextureDownloadModule.cs') diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs index ff2d418..5d22e2a 100644 --- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs @@ -49,8 +49,14 @@ namespace OpenSim.Region.Environment.Modules private Scene m_scene; private List m_scenes = new List(); + /// + /// There is one queue for all textures waiting to be sent, regardless of the requesting user. + /// private readonly BlockingQueue m_queueSenders = new BlockingQueue(); + /// + /// Each user has their own texture download queue. + /// private readonly Dictionary m_userTextureServices = new Dictionary(); @@ -80,13 +86,17 @@ namespace OpenSim.Region.Environment.Modules } } + /// + /// Cleanup the texture service related objects for the removed presence. + /// + /// private void EventManager_OnRemovePresence(LLUUID agentId) { UserTextureDownloadService textureService; lock (m_userTextureServices) { - if( m_userTextureServices.TryGetValue( agentId, out textureService )) + if (m_userTextureServices.TryGetValue(agentId, out textureService)) { textureService.Close(); @@ -118,6 +128,12 @@ namespace OpenSim.Region.Environment.Modules client.OnRequestTexture += TextureRequest; } + /// + /// Does this user have a registered texture download service? + /// + /// + /// + /// Always returns true, since a service is created if one does not already exist private bool TryGetUserTextureService(LLUUID userID, out UserTextureDownloadService textureService) { lock (m_userTextureServices) @@ -133,6 +149,11 @@ namespace OpenSim.Region.Environment.Modules } } + /// + /// Start the process of requesting a given texture. + /// + /// + /// public void TextureRequest(Object sender, TextureRequestArgs e) { IClientAPI client = (IClientAPI) sender; @@ -141,10 +162,12 @@ namespace OpenSim.Region.Environment.Modules { textureService.HandleTextureRequest(client, e); m_scene.AddPendingDownloads(1); - } - + } } + /// + /// Entry point for the thread dedicated to processing the texture queue. + /// public void ProcessTextureSenders() { TextureSender sender = null; @@ -179,11 +202,14 @@ namespace OpenSim.Region.Environment.Modules } } + /// + /// Called when the texture has finished sending. + /// + /// private void TextureSent(TextureSender sender) { sender.Sending = false; m_scene.AddPendingDownloads(-1); } - } } -- cgit v1.1