aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-02-25 23:26:35 +0000
committerJustin Clarke Casey2008-02-25 23:26:35 +0000
commit65862aaceadc69218895e07b5d547266b12916a9 (patch)
tree67449a6fe51b5c86cc14e75a41589cbaa2c5be5b /OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
parentMoved AsyncCommandManager into separate classes under "plugins". (diff)
downloadopensim-SC-65862aaceadc69218895e07b5d547266b12916a9.zip
opensim-SC-65862aaceadc69218895e07b5d547266b12916a9.tar.gz
opensim-SC-65862aaceadc69218895e07b5d547266b12916a9.tar.bz2
opensim-SC-65862aaceadc69218895e07b5d547266b12916a9.tar.xz
* Start sending "ImageNotFound" packet back to the client if we can't find an image
* This might stop some client's constant requests for unfound textures, which is a candidate for the memory leak * If a texture is not found then the "Image not found" texture will now be displayed clientside * If it works, this should resolve mantis 676 * Non texture image requests do not receive this packet yet * This will require a prebuild
Diffstat (limited to 'OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs35
1 files changed, 21 insertions, 14 deletions
diff --git a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
index 8987a19..77829f0 100644
--- a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
+++ b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
@@ -28,9 +28,13 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31
31using libsecondlife; 32using libsecondlife;
33using libsecondlife.Packets;
34
32using OpenSim.Framework; 35using OpenSim.Framework;
33using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Scenes; 38using OpenSim.Region.Environment.Scenes;
35 39
36namespace OpenSim.Region.Environment.Modules 40namespace OpenSim.Region.Environment.Modules
@@ -54,12 +58,16 @@ namespace OpenSim.Region.Environment.Modules
54 /// Texture Senders are placed in this queue once they have received their texture from the asset 58 /// Texture Senders are placed in this queue once they have received their texture from the asset
55 /// cache. Another module actually invokes the send. 59 /// cache. Another module actually invokes the send.
56 /// </summary> 60 /// </summary>
57 private readonly BlockingQueue<TextureSender> m_sharedSendersQueue; 61 private readonly BlockingQueue<ITextureSender> m_sharedSendersQueue;
58 62
59 private readonly Scene m_scene; 63 private readonly Scene m_scene;
64
65 private readonly IClientAPI m_client;
60 66
61 public UserTextureDownloadService(Scene scene, BlockingQueue<TextureSender> sharedQueue) 67 public UserTextureDownloadService(
68 IClientAPI client, Scene scene, BlockingQueue<ITextureSender> sharedQueue)
62 { 69 {
70 m_client = client;
63 m_scene = scene; 71 m_scene = scene;
64 m_sharedSendersQueue = sharedQueue; 72 m_sharedSendersQueue = sharedQueue;
65 } 73 }
@@ -68,9 +76,8 @@ namespace OpenSim.Region.Environment.Modules
68 /// Handle a texture request. This involves creating a texture sender and placing it on the 76 /// Handle a texture request. This involves creating a texture sender and placing it on the
69 /// previously passed in shared queue. 77 /// previously passed in shared queue.
70 /// </summary> 78 /// </summary>
71 /// <param name="client"> </param>
72 /// <param name="e"></param> 79 /// <param name="e"></param>
73 public void HandleTextureRequest(IClientAPI client, TextureRequestArgs e) 80 public void HandleTextureRequest(TextureRequestArgs e)
74 { 81 {
75 TextureSender textureSender; 82 TextureSender textureSender;
76 83
@@ -91,7 +98,7 @@ namespace OpenSim.Region.Environment.Modules
91 m_scene.AddPendingDownloads(1); 98 m_scene.AddPendingDownloads(1);
92 99
93 TextureSender requestHandler = 100 TextureSender requestHandler =
94 new TextureSender(client, e.DiscardLevel, e.PacketNumber); 101 new TextureSender(m_client, e.DiscardLevel, e.PacketNumber);
95 m_textureSenders.Add(e.RequestedAssetID, requestHandler); 102 m_textureSenders.Add(e.RequestedAssetID, requestHandler);
96 103
97 m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true); 104 m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true);
@@ -118,6 +125,8 @@ namespace OpenSim.Region.Environment.Modules
118 /// <param name="texture"></param> 125 /// <param name="texture"></param>
119 public void TextureCallback(LLUUID textureID, AssetBase texture) 126 public void TextureCallback(LLUUID textureID, AssetBase texture)
120 { 127 {
128 //m_log.DebugFormat("[USER TEXTURE DOWNLOAD SERVICE]: Calling TextureCallback with {0}, texture == null is {1}", textureID, (texture == null ? true : false));
129
121 lock (m_textureSenders) 130 lock (m_textureSenders)
122 { 131 {
123 TextureSender textureSender; 132 TextureSender textureSender;
@@ -129,13 +138,12 @@ namespace OpenSim.Region.Environment.Modules
129 // Needs investigation. 138 // Needs investigation.
130 if (texture == null || texture.Data == null) 139 if (texture == null || texture.Data == null)
131 { 140 {
132 // Right now, leaving it up to lower level asset server code to post the fact that 141 m_log.DebugFormat(
133 // this texture could not be found 142 "[USER TEXTURE DOWNLOAD SERVICE]: Queueing TextureNotFoundSender for {0}",
134 143 textureID);
135 // TODO Send packet back to the client telling it not to expect the texture 144
136 145 ITextureSender textureNotFoundSender = new TextureNotFoundSender(m_client, textureID);
137 //m_log.DebugFormat("[USER TEXTURE DOWNLOAD]: Removing download stat for {0}", textureID); 146 EnqueueTextureSender(textureNotFoundSender);
138 m_scene.AddPendingDownloads(-1);
139 } 147 }
140 else 148 else
141 { 149 {
@@ -163,11 +171,10 @@ namespace OpenSim.Region.Environment.Modules
163 /// Place a ready texture sender on the processing queue. 171 /// Place a ready texture sender on the processing queue.
164 /// </summary> 172 /// </summary>
165 /// <param name="textureSender"></param> 173 /// <param name="textureSender"></param>
166 private void EnqueueTextureSender(TextureSender textureSender) 174 private void EnqueueTextureSender(ITextureSender textureSender)
167 { 175 {
168 textureSender.Cancel = false; 176 textureSender.Cancel = false;
169 textureSender.Sending = true; 177 textureSender.Sending = true;
170 textureSender.counter = 0;
171 178
172 if (!m_sharedSendersQueue.Contains(textureSender)) 179 if (!m_sharedSendersQueue.Contains(textureSender))
173 { 180 {