* 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
This commit is contained in:
John Hurliman
2009-10-14 11:43:31 -07:00
parent 4135b0c4dc
commit 0d2e6463d7
9 changed files with 188 additions and 97 deletions

View File

@@ -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 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;
}
if (numCollected == count)
break;
}
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