aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs36
1 files changed, 35 insertions, 1 deletions
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;
35 35
36namespace OpenSim.Region.Environment.Modules 36namespace OpenSim.Region.Environment.Modules
37{ 37{
38 /// <summary>
39 /// This module sets up texture senders in response to client texture requests, and places them on a
40 /// processing queue once those senders have the appropriate data (i.e. a texture retrieved from the
41 /// asset cache).
42 /// </summary>
38 public class UserTextureDownloadService 43 public class UserTextureDownloadService
39 { 44 {
40 private static readonly log4net.ILog m_log 45 private static readonly log4net.ILog m_log
41 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 46 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
42 47
48 /// <summary>
49 /// Holds texture senders before they have received the appropriate texture from the asset cache.
50 /// </summary>
43 private readonly Dictionary<LLUUID, TextureSender> m_textureSenders = new Dictionary<LLUUID, TextureSender>(); 51 private readonly Dictionary<LLUUID, TextureSender> m_textureSenders = new Dictionary<LLUUID, TextureSender>();
52
53 /// <summary>
54 /// Texture Senders are placed in this queue once they have received their texture from the asset
55 /// cache. Another module actually invokes the send.
56 /// </summary>
44 private readonly BlockingQueue<TextureSender> m_sharedSendersQueue; 57 private readonly BlockingQueue<TextureSender> m_sharedSendersQueue;
58
45 private readonly Scene m_scene; 59 private readonly Scene m_scene;
46 60
47 public UserTextureDownloadService(Scene scene, BlockingQueue<TextureSender> sharedQueue) 61 public UserTextureDownloadService(Scene scene, BlockingQueue<TextureSender> sharedQueue)
@@ -50,6 +64,12 @@ namespace OpenSim.Region.Environment.Modules
50 m_sharedSendersQueue = sharedQueue; 64 m_sharedSendersQueue = sharedQueue;
51 } 65 }
52 66
67 /// <summary>
68 /// Handle a texture request. This involves creating a texture sender and placing it on the
69 /// previously passed in shared queue.
70 /// </summary>
71 /// <param name="client"> </param>
72 /// <param name="e"></param>
53 public void HandleTextureRequest(IClientAPI client, TextureRequestArgs e) 73 public void HandleTextureRequest(IClientAPI client, TextureRequestArgs e)
54 { 74 {
55 TextureSender textureSender; 75 TextureSender textureSender;
@@ -72,8 +92,9 @@ namespace OpenSim.Region.Environment.Modules
72 else 92 else
73 { 93 {
74 TextureSender requestHandler = 94 TextureSender requestHandler =
75 new TextureSender(client, e.RequestedAssetID, e.DiscardLevel, e.PacketNumber); 95 new TextureSender(client, e.DiscardLevel, e.PacketNumber);
76 m_textureSenders.Add(e.RequestedAssetID, requestHandler); 96 m_textureSenders.Add(e.RequestedAssetID, requestHandler);
97
77 m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback); 98 m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback);
78 } 99 }
79 } 100 }
@@ -90,6 +111,12 @@ namespace OpenSim.Region.Environment.Modules
90 } 111 }
91 } 112 }
92 113
114 /// <summary>
115 /// The callback for the asset cache when a texture has been retrieved. This method queues the
116 /// texture sender for processing.
117 /// </summary>
118 /// <param name="textureID"></param>
119 /// <param name="asset"></param>
93 public void TextureCallback(LLUUID textureID, AssetBase asset) 120 public void TextureCallback(LLUUID textureID, AssetBase asset)
94 { 121 {
95 lock (m_textureSenders) 122 lock (m_textureSenders)
@@ -115,6 +142,10 @@ namespace OpenSim.Region.Environment.Modules
115 } 142 }
116 } 143 }
117 144
145 /// <summary>
146 /// Place a ready texture sender on the processing queue.
147 /// </summary>
148 /// <param name="textureSender"></param>
118 private void EnqueueTextureSender(TextureSender textureSender) 149 private void EnqueueTextureSender(TextureSender textureSender)
119 { 150 {
120 textureSender.Cancel = false; 151 textureSender.Cancel = false;
@@ -127,6 +158,9 @@ namespace OpenSim.Region.Environment.Modules
127 } 158 }
128 } 159 }
129 160
161 /// <summary>
162 /// Close this module.
163 /// </summary>
130 internal void Close() 164 internal void Close()
131 { 165 {
132 lock (m_textureSenders) 166 lock (m_textureSenders)