From 3ba36bb4d8ef44514da85702c86aa49808774c72 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 2 Oct 2009 05:49:27 +0100 Subject: Restore the missing image handling to the image manager. The missing image packet crashes Hippo without a message. --- .../Region/ClientStack/LindenUDP/LLImageManager.cs | 144 +++++++++++---------- 1 file changed, 79 insertions(+), 65 deletions(-) (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs') 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 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private bool m_shuttingdown = false; private long m_lastloopprocessed = 0; + private AssetBase m_missingImage = null; private LLClientView m_client; //Client we're assigned to private IAssetService m_assetCache; //Asset Cache @@ -62,6 +63,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_client = client; m_assetCache = pAssetCache; + if (pAssetCache != null) + m_missingImage = pAssetCache.Get("5748decc-f629-461c-9a36-a35a221fe21f"); + else + m_log.Error("[ClientView] - couldn't set missing image asset, falling back to missing image packet. This is known to crash the client"); + m_j2kDecodeModule = pJ2kDecodeModule; } @@ -70,6 +76,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_client; } } + public AssetBase MissingImage + { + get { return m_missingImage; } + } + public void EnqueueReq(TextureRequestArgs newRequest) { //newRequest is the properties of our new texture fetch request. @@ -183,90 +194,93 @@ namespace OpenSim.Region.ClientStack.LindenUDP public bool ProcessImageQueue(int count, int maxpack) { - //count is the number of textures we want to process in one go. - //As part of this class re-write, that number will probably rise - //since we're processing in a more efficient manner. + lock (this) + { + //count is the number of textures we want to process in one go. + //As part of this class re-write, that number will probably rise + //since we're processing in a more efficient manner. - // this can happen during Close() - if (m_client == null) - return false; + // this can happen during Close() + if (m_client == null) + return false; - int numCollected = 0; + int numCollected = 0; - //Calculate our threshold - int threshold; - if (m_lastloopprocessed == 0) - { - if (m_client.PacketHandler == null || m_client.PacketHandler.PacketQueue == null || m_client.PacketHandler.PacketQueue.TextureThrottle == null) - return false; - //This is decent for a semi fast machine, but we'll calculate it more accurately based on time below - threshold = m_client.PacketHandler.PacketQueue.TextureThrottle.Current / 6300; - m_lastloopprocessed = DateTime.Now.Ticks; - } - else - { - double throttleseconds = ((double)DateTime.Now.Ticks - (double)m_lastloopprocessed) / (double)TimeSpan.TicksPerSecond; - throttleseconds = throttleseconds * m_client.PacketHandler.PacketQueue.TextureThrottle.Current; + //Calculate our threshold + int threshold; + if (m_lastloopprocessed == 0) + { + if (m_client.PacketHandler == null || m_client.PacketHandler.PacketQueue == null || m_client.PacketHandler.PacketQueue.TextureThrottle == null) + return false; + //This is decent for a semi fast machine, but we'll calculate it more accurately based on time below + threshold = m_client.PacketHandler.PacketQueue.TextureThrottle.Current / 6300; + m_lastloopprocessed = DateTime.Now.Ticks; + } + else + { + double throttleseconds = ((double)DateTime.Now.Ticks - (double)m_lastloopprocessed) / (double)TimeSpan.TicksPerSecond; + throttleseconds = throttleseconds * m_client.PacketHandler.PacketQueue.TextureThrottle.Current; - //Average of 1000 bytes per packet - throttleseconds = throttleseconds / 1000; + //Average of 1000 bytes per packet + throttleseconds = throttleseconds / 1000; - //Safe-zone multiplier of 2.0 - threshold = (int)(throttleseconds * 2.0); - m_lastloopprocessed = DateTime.Now.Ticks; + //Safe-zone multiplier of 2.0 + threshold = (int)(throttleseconds * 2.0); + m_lastloopprocessed = DateTime.Now.Ticks; - } + } - if (m_client.PacketHandler == null) - return false; + if (m_client.PacketHandler == null) + return false; - if (m_client.PacketHandler.PacketQueue == null) - return false; + if (m_client.PacketHandler.PacketQueue == null) + return false; - if (threshold < 10) - threshold = 10; + if (threshold < 10) + threshold = 10; - //Uncomment this to see what the texture stack is doing - //m_log.Debug("Queue: " + m_client.PacketHandler.PacketQueue.getQueueCount(ThrottleOutPacketType.Texture).ToString() + " Threshold: " + threshold.ToString() + " outstanding: " + m_outstandingtextures.ToString()); - if (m_client.PacketHandler.PacketQueue.GetQueueCount(ThrottleOutPacketType.Texture) < threshold) - { - while (m_priorityQueue.Count > 0) + //Uncomment this to see what the texture stack is doing + //m_log.Debug("Queue: " + m_client.PacketHandler.PacketQueue.getQueueCount(ThrottleOutPacketType.Texture).ToString() + " Threshold: " + threshold.ToString() + " outstanding: " + m_outstandingtextures.ToString()); + if (true) //m_client.PacketHandler.PacketQueue.GetQueueCount(ThrottleOutPacketType.Texture) < threshold) { - J2KImage imagereq = null; - lock (m_priorityQueue) - imagereq = m_priorityQueue.FindMax(); - - if (imagereq.m_decoded == true) + while (m_priorityQueue.Count > 0) { - // we need to test this here now that we are dropping assets - if (!imagereq.m_hasasset) - { - m_log.WarnFormat("[LLIMAGE MANAGER]: Re-requesting the image asset {0}", imagereq.m_requestedUUID); - imagereq.RunUpdate(); - continue; - } - - ++numCollected; + J2KImage imagereq = null; + lock (m_priorityQueue) + imagereq = m_priorityQueue.FindMax(); - //SendPackets will send up to ten packets per cycle - if (imagereq.SendPackets(m_client, maxpack)) + if (imagereq.m_decoded == true) { - // Send complete. Destroy any knowledge of this transfer - try - { - lock (m_priorityQueue) - m_priorityQueue.Delete(imagereq.m_priorityQueueHandle); + // we need to test this here now that we are dropping assets + if (!imagereq.m_hasasset) + { + m_log.WarnFormat("[LLIMAGE MANAGER]: Re-requesting the image asset {0}", imagereq.m_requestedUUID); + imagereq.RunUpdate(); + continue; + } + + ++numCollected; + + //SendPackets will send up to ten packets per cycle + if (imagereq.SendPackets(m_client, maxpack)) + { + // Send complete. Destroy any knowledge of this transfer + try + { + lock (m_priorityQueue) + m_priorityQueue.Delete(imagereq.m_priorityQueueHandle); + } + catch (Exception) { } } - catch (Exception) { } } - } - if (numCollected == count) - break; + if (numCollected == count) + break; + } } - } - return m_priorityQueue.Count > 0; + return m_priorityQueue.Count > 0; + } } //Faux destructor -- cgit v1.1