aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-02-19 23:42:30 +0000
committerJustin Clarke Casey2008-02-19 23:42:30 +0000
commit48e085c77451643cb7d819fc8c743a863b645a40 (patch)
tree7c38db2282e765b7750bf693cd05296645a08410 /OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
parentPutting in eyecatcher lines on OpenSim start as we had previously. This make... (diff)
downloadopensim-SC_OLD-48e085c77451643cb7d819fc8c743a863b645a40.zip
opensim-SC_OLD-48e085c77451643cb7d819fc8c743a863b645a40.tar.gz
opensim-SC_OLD-48e085c77451643cb7d819fc8c743a863b645a40.tar.bz2
opensim-SC_OLD-48e085c77451643cb7d819fc8c743a863b645a40.tar.xz
* 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.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/TextureDownloadModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs34
1 files changed, 30 insertions, 4 deletions
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
49 private Scene m_scene; 49 private Scene m_scene;
50 private List<Scene> m_scenes = new List<Scene>(); 50 private List<Scene> m_scenes = new List<Scene>();
51 51
52 /// <summary>
53 /// There is one queue for all textures waiting to be sent, regardless of the requesting user.
54 /// </summary>
52 private readonly BlockingQueue<TextureSender> m_queueSenders = new BlockingQueue<TextureSender>(); 55 private readonly BlockingQueue<TextureSender> m_queueSenders = new BlockingQueue<TextureSender>();
53 56
57 /// <summary>
58 /// Each user has their own texture download queue.
59 /// </summary>
54 private readonly Dictionary<LLUUID, UserTextureDownloadService> m_userTextureServices = 60 private readonly Dictionary<LLUUID, UserTextureDownloadService> m_userTextureServices =
55 new Dictionary<LLUUID, UserTextureDownloadService>(); 61 new Dictionary<LLUUID, UserTextureDownloadService>();
56 62
@@ -80,13 +86,17 @@ namespace OpenSim.Region.Environment.Modules
80 } 86 }
81 } 87 }
82 88
89 /// <summary>
90 /// Cleanup the texture service related objects for the removed presence.
91 /// </summary>
92 /// <param name="agentId"> </param>
83 private void EventManager_OnRemovePresence(LLUUID agentId) 93 private void EventManager_OnRemovePresence(LLUUID agentId)
84 { 94 {
85 UserTextureDownloadService textureService; 95 UserTextureDownloadService textureService;
86 96
87 lock (m_userTextureServices) 97 lock (m_userTextureServices)
88 { 98 {
89 if( m_userTextureServices.TryGetValue( agentId, out textureService )) 99 if (m_userTextureServices.TryGetValue(agentId, out textureService))
90 { 100 {
91 textureService.Close(); 101 textureService.Close();
92 102
@@ -118,6 +128,12 @@ namespace OpenSim.Region.Environment.Modules
118 client.OnRequestTexture += TextureRequest; 128 client.OnRequestTexture += TextureRequest;
119 } 129 }
120 130
131 /// <summary>
132 /// Does this user have a registered texture download service?
133 /// </summary>
134 /// <param name="userID"></param>
135 /// <param name="textureService"></param>
136 /// <returns>Always returns true, since a service is created if one does not already exist</returns>
121 private bool TryGetUserTextureService(LLUUID userID, out UserTextureDownloadService textureService) 137 private bool TryGetUserTextureService(LLUUID userID, out UserTextureDownloadService textureService)
122 { 138 {
123 lock (m_userTextureServices) 139 lock (m_userTextureServices)
@@ -133,6 +149,11 @@ namespace OpenSim.Region.Environment.Modules
133 } 149 }
134 } 150 }
135 151
152 /// <summary>
153 /// Start the process of requesting a given texture.
154 /// </summary>
155 /// <param name="sender"> </param>
156 /// <param name="e"></param>
136 public void TextureRequest(Object sender, TextureRequestArgs e) 157 public void TextureRequest(Object sender, TextureRequestArgs e)
137 { 158 {
138 IClientAPI client = (IClientAPI) sender; 159 IClientAPI client = (IClientAPI) sender;
@@ -141,10 +162,12 @@ namespace OpenSim.Region.Environment.Modules
141 { 162 {
142 textureService.HandleTextureRequest(client, e); 163 textureService.HandleTextureRequest(client, e);
143 m_scene.AddPendingDownloads(1); 164 m_scene.AddPendingDownloads(1);
144 } 165 }
145
146 } 166 }
147 167
168 /// <summary>
169 /// Entry point for the thread dedicated to processing the texture queue.
170 /// </summary>
148 public void ProcessTextureSenders() 171 public void ProcessTextureSenders()
149 { 172 {
150 TextureSender sender = null; 173 TextureSender sender = null;
@@ -179,11 +202,14 @@ namespace OpenSim.Region.Environment.Modules
179 } 202 }
180 } 203 }
181 204
205 /// <summary>
206 /// Called when the texture has finished sending.
207 /// </summary>
208 /// <param name="sender"></param>
182 private void TextureSent(TextureSender sender) 209 private void TextureSent(TextureSender sender)
183 { 210 {
184 sender.Sending = false; 211 sender.Sending = false;
185 m_scene.AddPendingDownloads(-1); 212 m_scene.AddPendingDownloads(-1);
186 } 213 }
187
188 } 214 }
189} 215}