aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs66
1 files changed, 43 insertions, 23 deletions
diff --git a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
index 7ec78a4..aa17cec 100644
--- a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
+++ b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs
@@ -64,7 +64,12 @@ namespace OpenSim.Region.Environment.Modules
64 /// XXX This is really a temporary solution to deal with the situation where a client continually requests 64 /// XXX This is really a temporary solution to deal with the situation where a client continually requests
65 /// the same missing textures 65 /// the same missing textures
66 /// </summary> 66 /// </summary>
67 private readonly Dictionary<LLUUID, int> missingTextureRequests = new Dictionary<LLUUID, int>(); 67 private readonly Dictionary<LLUUID, int> missingTextureRequestCounts = new Dictionary<LLUUID, int>();
68
69 /// <summary>
70 /// XXX Also going to record all the textures found and dispatched
71 /// </summary>
72 private readonly Dictionary<LLUUID, int> dispatchedTextureRequestCounts = new Dictionary<LLUUID, int>();
68 73
69 private readonly Scene m_scene; 74 private readonly Scene m_scene;
70 75
@@ -99,12 +104,14 @@ namespace OpenSim.Region.Environment.Modules
99 textureSender.UpdateRequest(e.DiscardLevel, e.PacketNumber); 104 textureSender.UpdateRequest(e.DiscardLevel, e.PacketNumber);
100 } 105 }
101 else 106 else
102 { 107 {
103 // If we've already told the client we're missing the texture, then don't ask the 108 // If we've already told the client we're missing the texture, then don't ask the
104 // asset server for it again - record the fact that it's missing instead. 109 // asset server for it again - record the fact that it's missing instead.
105 if (missingTextureRequests.ContainsKey(e.RequestedAssetID)) 110 // XXX This is to reduce (but not resolve) a current problem where some clients keep
111 // requesting the same textures
112 if (missingTextureRequestCounts.ContainsKey(e.RequestedAssetID))
106 { 113 {
107 int requests = missingTextureRequests[e.RequestedAssetID] + 1; 114 int requests = missingTextureRequestCounts[e.RequestedAssetID] + 1;
108 115
109 if (requests % 20 == 0) 116 if (requests % 20 == 0)
110 { 117 {
@@ -113,18 +120,32 @@ namespace OpenSim.Region.Environment.Modules
113 requests, e.RequestedAssetID, m_client.AgentId); 120 requests, e.RequestedAssetID, m_client.AgentId);
114 } 121 }
115 122
116 missingTextureRequests[e.RequestedAssetID] = requests; 123 missingTextureRequestCounts[e.RequestedAssetID] = requests;
117 } 124 }
118 else 125 else
119 { 126 {
127 // Warn the log if we're getting requests for textures we've already dispatched
128 if (dispatchedTextureRequestCounts.ContainsKey(e.RequestedAssetID))
129 {
130 int requests = dispatchedTextureRequestCounts[e.RequestedAssetID] + 1;
131
132 if (requests % 20 == 0)
133 {
134 m_log.WarnFormat(
135 "[USER TEXTURE DOWNLOAD SERVICE]: Received {0} requests for already dispatched texture {1} from client {2}",
136 requests, e.RequestedAssetID, m_client.AgentId);
137 }
138
139 dispatchedTextureRequestCounts[e.RequestedAssetID] = requests;
140 }
141
120 //m_log.DebugFormat("[USER TEXTURE DOWNLOAD]: Adding download stat {0}", e.RequestedAssetID); 142 //m_log.DebugFormat("[USER TEXTURE DOWNLOAD]: Adding download stat {0}", e.RequestedAssetID);
121 m_scene.AddPendingDownloads(1); 143 m_scene.AddPendingDownloads(1);
122 144
123 TextureSender requestHandler = 145 TextureSender requestHandler = new TextureSender(m_client, e.DiscardLevel, e.PacketNumber);
124 new TextureSender(m_client, e.DiscardLevel, e.PacketNumber);
125 m_textureSenders.Add(e.RequestedAssetID, requestHandler); 146 m_textureSenders.Add(e.RequestedAssetID, requestHandler);
126 147
127 m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true); 148 m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true);
128 } 149 }
129 } 150 }
130 } 151 }
@@ -162,20 +183,13 @@ namespace OpenSim.Region.Environment.Modules
162 // Needs investigation. 183 // Needs investigation.
163 if (texture == null || texture.Data == null) 184 if (texture == null || texture.Data == null)
164 { 185 {
165 // We're only going to tell the client once about a missing texture, even if it keeps asking 186 m_log.DebugFormat(
166 // XXX This is to reduce (but not resolve) a current problem where some clients keep requesting the same textures 187 "[USER TEXTURE DOWNLOAD SERVICE]: Queueing TextureNotFoundSender for {0}, client {1}",
167 // - one might want to do this for all asset requests (or allow a number of retries) in the 188 textureID, m_client.AgentId);
168 // longer term. 189
169 if (!missingTextureRequests.ContainsKey(textureID)) 190 ITextureSender textureNotFoundSender = new TextureNotFoundSender(m_client, textureID);
170 { 191 EnqueueTextureSender(textureNotFoundSender);
171 m_log.DebugFormat( 192 missingTextureRequestCounts.Add(textureID, 1);
172 "[USER TEXTURE DOWNLOAD SERVICE]: Queueing TextureNotFoundSender for {0}, client {1}",
173 textureID, m_client.AgentId);
174
175 ITextureSender textureNotFoundSender = new TextureNotFoundSender(m_client, textureID);
176 EnqueueTextureSender(textureNotFoundSender);
177 missingTextureRequests.Add(textureID, 1);
178 }
179 } 193 }
180 else 194 else
181 { 195 {
@@ -183,6 +197,12 @@ namespace OpenSim.Region.Environment.Modules
183 { 197 {
184 textureSender.TextureReceived(texture); 198 textureSender.TextureReceived(texture);
185 EnqueueTextureSender(textureSender); 199 EnqueueTextureSender(textureSender);
200
201 // Record the fact that we've put this texture in for dispatch
202 if (!dispatchedTextureRequestCounts.ContainsKey(textureID))
203 {
204 dispatchedTextureRequestCounts.Add(textureID, 1);
205 }
186 } 206 }
187 } 207 }
188 208