diff options
author | Melanie | 2009-10-02 05:49:27 +0100 |
---|---|---|
committer | Melanie | 2009-10-02 05:49:27 +0100 |
commit | 3ba36bb4d8ef44514da85702c86aa49808774c72 (patch) | |
tree | bf272f68031e49abf2ad2c1fc5845213406112f9 | |
parent | Merge branch 'diva-textures-osgrid' into texturetest (diff) | |
download | opensim-SC-3ba36bb4d8ef44514da85702c86aa49808774c72.zip opensim-SC-3ba36bb4d8ef44514da85702c86aa49808774c72.tar.gz opensim-SC-3ba36bb4d8ef44514da85702c86aa49808774c72.tar.bz2 opensim-SC-3ba36bb4d8ef44514da85702c86aa49808774c72.tar.xz |
Restore the missing image handling to the image manager. The missing
image packet crashes Hippo without a message.
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | 16 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs | 144 |
3 files changed, 92 insertions, 71 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index b958b01..5f549b5 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | |||
@@ -235,7 +235,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
235 | 235 | ||
236 | if (m_imageManager.Client.PacketHandler.GetQueueCount(ThrottleOutPacketType.Texture) == 0) | 236 | if (m_imageManager.Client.PacketHandler.GetQueueCount(ThrottleOutPacketType.Texture) == 0) |
237 | { | 237 | { |
238 | m_log.Debug("No textures queued, sending one packet to kickstart it"); | 238 | //m_log.Debug("No textures queued, sending one packet to kickstart it"); |
239 | SendPacket(m_imageManager.Client); | 239 | SendPacket(m_imageManager.Client); |
240 | } | 240 | } |
241 | } | 241 | } |
@@ -333,7 +333,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
333 | if (Data == null) | 333 | if (Data == null) |
334 | { | 334 | { |
335 | client.SendImageNotFound(m_requestedUUID); | 335 | client.SendImageNotFound(m_requestedUUID); |
336 | m_log.WarnFormat("[TEXTURE]: Got null Data element on a asset {0}.. and the missing image Data property is al", m_requestedUUID); | 336 | m_log.WarnFormat("[TEXTURE]: Got null Data element on a asset {0}.. and the missing image Data property is also null", m_requestedUUID); |
337 | return true; | 337 | return true; |
338 | } | 338 | } |
339 | // Do we have less then 1 packet's worth of data? | 339 | // Do we have less then 1 packet's worth of data? |
@@ -374,8 +374,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
374 | 374 | ||
375 | if (asset == null || asset.Data == null) | 375 | if (asset == null || asset.Data == null) |
376 | { | 376 | { |
377 | m_asset = null; | 377 | if (m_imageManager.MissingImage != null) |
378 | m_decoded = true; | 378 | { |
379 | m_asset = m_imageManager.MissingImage; | ||
380 | m_assetDataLength = m_asset.Data.Length; | ||
381 | } | ||
382 | else | ||
383 | { | ||
384 | m_asset = null; | ||
385 | m_decoded = true; | ||
386 | } | ||
379 | } | 387 | } |
380 | else | 388 | else |
381 | { | 389 | { |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 23fa1a3..f05c490 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -141,7 +141,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
141 | protected int m_primTerseUpdateRate = 10; | 141 | protected int m_primTerseUpdateRate = 10; |
142 | protected int m_primFullUpdateRate = 14; | 142 | protected int m_primFullUpdateRate = 14; |
143 | 143 | ||
144 | protected int m_textureSendLimit = 100; | 144 | protected int m_textureSendLimit = 20; |
145 | protected int m_textureDataLimit = 10; | 145 | protected int m_textureDataLimit = 10; |
146 | 146 | ||
147 | protected int m_packetMTU = 1400; | 147 | protected int m_packetMTU = 1400; |
@@ -3139,7 +3139,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3139 | switch (queue) | 3139 | switch (queue) |
3140 | { | 3140 | { |
3141 | case ThrottleOutPacketType.Texture: | 3141 | case ThrottleOutPacketType.Texture: |
3142 | m_log.Debug("Texture queue empty"); | ||
3143 | ProcessTextureRequests(); | 3142 | ProcessTextureRequests(); |
3144 | break; | 3143 | break; |
3145 | } | 3144 | } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index fcdf857..a484fdf 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs | |||
@@ -52,6 +52,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | private bool m_shuttingdown = false; | 53 | private bool m_shuttingdown = false; |
54 | private long m_lastloopprocessed = 0; | 54 | private long m_lastloopprocessed = 0; |
55 | private AssetBase m_missingImage = null; | ||
55 | 56 | ||
56 | private LLClientView m_client; //Client we're assigned to | 57 | private LLClientView m_client; //Client we're assigned to |
57 | private IAssetService m_assetCache; //Asset Cache | 58 | private IAssetService m_assetCache; //Asset Cache |
@@ -62,6 +63,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
62 | { | 63 | { |
63 | m_client = client; | 64 | m_client = client; |
64 | m_assetCache = pAssetCache; | 65 | m_assetCache = pAssetCache; |
66 | if (pAssetCache != null) | ||
67 | m_missingImage = pAssetCache.Get("5748decc-f629-461c-9a36-a35a221fe21f"); | ||
68 | else | ||
69 | m_log.Error("[ClientView] - couldn't set missing image asset, falling back to missing image packet. This is known to crash the client"); | ||
70 | |||
65 | m_j2kDecodeModule = pJ2kDecodeModule; | 71 | m_j2kDecodeModule = pJ2kDecodeModule; |
66 | } | 72 | } |
67 | 73 | ||
@@ -70,6 +76,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
70 | get { return m_client; } | 76 | get { return m_client; } |
71 | } | 77 | } |
72 | 78 | ||
79 | public AssetBase MissingImage | ||
80 | { | ||
81 | get { return m_missingImage; } | ||
82 | } | ||
83 | |||
73 | public void EnqueueReq(TextureRequestArgs newRequest) | 84 | public void EnqueueReq(TextureRequestArgs newRequest) |
74 | { | 85 | { |
75 | //newRequest is the properties of our new texture fetch request. | 86 | //newRequest is the properties of our new texture fetch request. |
@@ -183,90 +194,93 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
183 | 194 | ||
184 | public bool ProcessImageQueue(int count, int maxpack) | 195 | public bool ProcessImageQueue(int count, int maxpack) |
185 | { | 196 | { |
186 | //count is the number of textures we want to process in one go. | 197 | lock (this) |
187 | //As part of this class re-write, that number will probably rise | 198 | { |
188 | //since we're processing in a more efficient manner. | 199 | //count is the number of textures we want to process in one go. |
200 | //As part of this class re-write, that number will probably rise | ||
201 | //since we're processing in a more efficient manner. | ||
189 | 202 | ||
190 | // this can happen during Close() | 203 | // this can happen during Close() |
191 | if (m_client == null) | 204 | if (m_client == null) |
192 | return false; | 205 | return false; |
193 | 206 | ||
194 | int numCollected = 0; | 207 | int numCollected = 0; |
195 | 208 | ||
196 | //Calculate our threshold | 209 | //Calculate our threshold |
197 | int threshold; | 210 | int threshold; |
198 | if (m_lastloopprocessed == 0) | 211 | if (m_lastloopprocessed == 0) |
199 | { | 212 | { |
200 | if (m_client.PacketHandler == null || m_client.PacketHandler.PacketQueue == null || m_client.PacketHandler.PacketQueue.TextureThrottle == null) | 213 | if (m_client.PacketHandler == null || m_client.PacketHandler.PacketQueue == null || m_client.PacketHandler.PacketQueue.TextureThrottle == null) |
201 | return false; | 214 | return false; |
202 | //This is decent for a semi fast machine, but we'll calculate it more accurately based on time below | 215 | //This is decent for a semi fast machine, but we'll calculate it more accurately based on time below |
203 | threshold = m_client.PacketHandler.PacketQueue.TextureThrottle.Current / 6300; | 216 | threshold = m_client.PacketHandler.PacketQueue.TextureThrottle.Current / 6300; |
204 | m_lastloopprocessed = DateTime.Now.Ticks; | 217 | m_lastloopprocessed = DateTime.Now.Ticks; |
205 | } | 218 | } |
206 | else | 219 | else |
207 | { | 220 | { |
208 | double throttleseconds = ((double)DateTime.Now.Ticks - (double)m_lastloopprocessed) / (double)TimeSpan.TicksPerSecond; | 221 | double throttleseconds = ((double)DateTime.Now.Ticks - (double)m_lastloopprocessed) / (double)TimeSpan.TicksPerSecond; |
209 | throttleseconds = throttleseconds * m_client.PacketHandler.PacketQueue.TextureThrottle.Current; | 222 | throttleseconds = throttleseconds * m_client.PacketHandler.PacketQueue.TextureThrottle.Current; |
210 | 223 | ||
211 | //Average of 1000 bytes per packet | 224 | //Average of 1000 bytes per packet |
212 | throttleseconds = throttleseconds / 1000; | 225 | throttleseconds = throttleseconds / 1000; |
213 | 226 | ||
214 | //Safe-zone multiplier of 2.0 | 227 | //Safe-zone multiplier of 2.0 |
215 | threshold = (int)(throttleseconds * 2.0); | 228 | threshold = (int)(throttleseconds * 2.0); |
216 | m_lastloopprocessed = DateTime.Now.Ticks; | 229 | m_lastloopprocessed = DateTime.Now.Ticks; |
217 | 230 | ||
218 | } | 231 | } |
219 | 232 | ||
220 | if (m_client.PacketHandler == null) | 233 | if (m_client.PacketHandler == null) |
221 | return false; | 234 | return false; |
222 | 235 | ||
223 | if (m_client.PacketHandler.PacketQueue == null) | 236 | if (m_client.PacketHandler.PacketQueue == null) |
224 | return false; | 237 | return false; |
225 | 238 | ||
226 | if (threshold < 10) | 239 | if (threshold < 10) |
227 | threshold = 10; | 240 | threshold = 10; |
228 | 241 | ||
229 | //Uncomment this to see what the texture stack is doing | 242 | //Uncomment this to see what the texture stack is doing |
230 | //m_log.Debug("Queue: " + m_client.PacketHandler.PacketQueue.getQueueCount(ThrottleOutPacketType.Texture).ToString() + " Threshold: " + threshold.ToString() + " outstanding: " + m_outstandingtextures.ToString()); | 243 | //m_log.Debug("Queue: " + m_client.PacketHandler.PacketQueue.getQueueCount(ThrottleOutPacketType.Texture).ToString() + " Threshold: " + threshold.ToString() + " outstanding: " + m_outstandingtextures.ToString()); |
231 | if (m_client.PacketHandler.PacketQueue.GetQueueCount(ThrottleOutPacketType.Texture) < threshold) | 244 | if (true) //m_client.PacketHandler.PacketQueue.GetQueueCount(ThrottleOutPacketType.Texture) < threshold) |
232 | { | ||
233 | while (m_priorityQueue.Count > 0) | ||
234 | { | 245 | { |
235 | J2KImage imagereq = null; | 246 | while (m_priorityQueue.Count > 0) |
236 | lock (m_priorityQueue) | ||
237 | imagereq = m_priorityQueue.FindMax(); | ||
238 | |||
239 | if (imagereq.m_decoded == true) | ||
240 | { | 247 | { |
241 | // we need to test this here now that we are dropping assets | 248 | J2KImage imagereq = null; |
242 | if (!imagereq.m_hasasset) | 249 | lock (m_priorityQueue) |
243 | { | 250 | imagereq = m_priorityQueue.FindMax(); |
244 | m_log.WarnFormat("[LLIMAGE MANAGER]: Re-requesting the image asset {0}", imagereq.m_requestedUUID); | ||
245 | imagereq.RunUpdate(); | ||
246 | continue; | ||
247 | } | ||
248 | |||
249 | ++numCollected; | ||
250 | 251 | ||
251 | //SendPackets will send up to ten packets per cycle | 252 | if (imagereq.m_decoded == true) |
252 | if (imagereq.SendPackets(m_client, maxpack)) | ||
253 | { | 253 | { |
254 | // Send complete. Destroy any knowledge of this transfer | 254 | // we need to test this here now that we are dropping assets |
255 | try | 255 | if (!imagereq.m_hasasset) |
256 | { | 256 | { |
257 | lock (m_priorityQueue) | 257 | m_log.WarnFormat("[LLIMAGE MANAGER]: Re-requesting the image asset {0}", imagereq.m_requestedUUID); |
258 | m_priorityQueue.Delete(imagereq.m_priorityQueueHandle); | 258 | imagereq.RunUpdate(); |
259 | continue; | ||
260 | } | ||
261 | |||
262 | ++numCollected; | ||
263 | |||
264 | //SendPackets will send up to ten packets per cycle | ||
265 | if (imagereq.SendPackets(m_client, maxpack)) | ||
266 | { | ||
267 | // Send complete. Destroy any knowledge of this transfer | ||
268 | try | ||
269 | { | ||
270 | lock (m_priorityQueue) | ||
271 | m_priorityQueue.Delete(imagereq.m_priorityQueueHandle); | ||
272 | } | ||
273 | catch (Exception) { } | ||
259 | } | 274 | } |
260 | catch (Exception) { } | ||
261 | } | 275 | } |
262 | } | ||
263 | 276 | ||
264 | if (numCollected == count) | 277 | if (numCollected == count) |
265 | break; | 278 | break; |
279 | } | ||
266 | } | 280 | } |
267 | } | ||
268 | 281 | ||
269 | return m_priorityQueue.Count > 0; | 282 | return m_priorityQueue.Count > 0; |
283 | } | ||
270 | } | 284 | } |
271 | 285 | ||
272 | //Faux destructor | 286 | //Faux destructor |