From 0d2e6463d714bce8a6a628bd647c625feeeae8f6 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 14 Oct 2009 11:43:31 -0700 Subject: * Minimized the number of times textures are pulled off the priority queue * OnQueueEmpty is still called async, but will not be called for a given category if the previous callback for that category is still running. This is the most balanced behavior I could find, and seems to work well * Added support for the old [ClientStack.LindenUDP] settings (including setting the receive buffer size) and added the new token bucket and global throttle settings * Added the AssetLoaderEnabled config variable to optionally disable loading assets from XML every startup. This gives a dramatic improvement in startup times for those who don't need the functionality every startup --- .../Region/ClientStack/LindenUDP/LLImageManager.cs | 48 +++++++++++----------- 1 file changed, 25 insertions(+), 23 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 8410ee9..9d36cff 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs @@ -162,32 +162,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - public bool ProcessImageQueue(int count, int maxpack) + public bool ProcessImageQueue(int packetsToSend) { - J2KImage imagereq; - int numCollected = 0; - m_lastloopprocessed = DateTime.Now.Ticks; + int packetsSent = 0; - // This can happen during Close() - if (m_client == null) - return false; - - while ((imagereq = GetHighestPriorityImage()) != null) + while (packetsSent < packetsToSend) { - if (imagereq.IsDecoded == true) + J2KImage image = GetHighestPriorityImage(); + + // If null was returned, the texture priority queue is currently empty + if (image == null) + return false; + + if (image.IsDecoded) { - ++numCollected; + int sent; + bool imageDone = image.SendPackets(m_client, packetsToSend - packetsSent, out sent); - if (imagereq.SendPackets(m_client, maxpack)) - { - // Send complete. Destroy any knowledge of this transfer - RemoveImageFromQueue(imagereq); - } - } + packetsSent += sent; - if (numCollected == count) - break; + // If the send is complete, destroy any knowledge of this transfer + if (imageDone) + RemoveImageFromQueue(image); + } + else + { + // TODO: This is a limitation of how LLImageManager is currently + // written. Undecoded textures should not be going into the priority + // queue, because a high priority undecoded texture will clog up the + // pipeline for a client + return true; + } } return m_priorityQueue.Count > 0; @@ -199,10 +205,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void Close() { m_shuttingdown = true; - m_priorityQueue = null; - m_j2kDecodeModule = null; - m_assetCache = null; - m_client = null; } #region Priority Queue Helpers -- cgit v1.1