mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
Thanks jhurliman for a patch that implements progressive texture downloading - Mantis #2655
This commit is contained in:
@@ -241,44 +241,52 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
||||
{
|
||||
ITextureSender sender = null;
|
||||
|
||||
try
|
||||
{
|
||||
// try
|
||||
// {
|
||||
while (true)
|
||||
{
|
||||
sender = m_queueSenders.Dequeue();
|
||||
|
||||
if (sender.Cancel)
|
||||
try
|
||||
{
|
||||
TextureSent(sender);
|
||||
sender = m_queueSenders.Dequeue();
|
||||
|
||||
sender.Cancel = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool finished = sender.SendTexturePacket();
|
||||
if (finished)
|
||||
if (sender.Cancel)
|
||||
{
|
||||
TextureSent(sender);
|
||||
|
||||
sender.Cancel = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_queueSenders.Enqueue(sender);
|
||||
bool finished = sender.SendTexturePacket();
|
||||
if (finished)
|
||||
{
|
||||
TextureSent(sender);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_queueSenders.Enqueue(sender);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure that any sender we currently have can get garbage collected
|
||||
sender = null;
|
||||
|
||||
//m_log.InfoFormat("[TEXTURE] Texture sender queue size: {0}", m_queueSenders.Count());
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[TEXTURE]: Texture send thread caught exception. The texture send was aborted. Exception is {0}", e);
|
||||
}
|
||||
|
||||
// Make sure that any sender we currently have can get garbage collected
|
||||
sender = null;
|
||||
|
||||
//m_log.InfoFormat("[TEXTURE] Texture sender queue size: {0}", m_queueSenders.Count());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened
|
||||
m_log.ErrorFormat(
|
||||
"[TEXTURE]: Texture send thread terminating with exception. PLEASE REBOOT YOUR SIM - TEXTURES WILL NOT BE AVAILABLE UNTIL YOU DO. Exception is {0}",
|
||||
e);
|
||||
}
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// // TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened
|
||||
// m_log.ErrorFormat(
|
||||
// "[TEXTURE]: Texture send thread terminating with exception. PLEASE REBOOT YOUR SIM - TEXTURES WILL NOT BE AVAILABLE UNTIL YOU DO. Exception is {0}",
|
||||
// e);
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
|
||||
|
||||
@@ -56,11 +56,10 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
||||
/// <summary>
|
||||
/// We will allow the client to request the same texture n times before dropping further requests
|
||||
///
|
||||
/// This number includes repeated requests for the same texture at different resolutions (which we don't
|
||||
/// currently handle properly as far as I know). However, this situation should be handled in a more
|
||||
/// sophisticated way.
|
||||
/// This number contains repeated requests for the same texture at different resolutions (which
|
||||
/// are handled since r7368). However, this situation should be handled in a more sophisticated way.
|
||||
/// </summary>
|
||||
private static readonly int MAX_ALLOWED_TEXTURE_REQUESTS = 5;
|
||||
private static readonly int MAX_ALLOWED_TEXTURE_REQUESTS = 15;
|
||||
|
||||
/// <summary>
|
||||
/// XXX Also going to limit requests for found textures.
|
||||
@@ -149,7 +148,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
||||
|
||||
m_scene.AddPendingDownloads(1);
|
||||
|
||||
TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber);
|
||||
TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber, e.Priority);
|
||||
m_textureSenders.Add(e.RequestedAssetID, requestHandler);
|
||||
|
||||
m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true);
|
||||
|
||||
Reference in New Issue
Block a user