Restore the missing image handling to the image manager. The missing

image packet crashes Hippo without a message.
prioritization
Melanie 2009-10-02 05:49:27 +01:00
parent 9a429610e2
commit 3ba36bb4d8
3 changed files with 104 additions and 83 deletions

View File

@ -235,7 +235,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_imageManager.Client.PacketHandler.GetQueueCount(ThrottleOutPacketType.Texture) == 0) if (m_imageManager.Client.PacketHandler.GetQueueCount(ThrottleOutPacketType.Texture) == 0)
{ {
m_log.Debug("No textures queued, sending one packet to kickstart it"); //m_log.Debug("No textures queued, sending one packet to kickstart it");
SendPacket(m_imageManager.Client); SendPacket(m_imageManager.Client);
} }
} }
@ -333,7 +333,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (Data == null) if (Data == null)
{ {
client.SendImageNotFound(m_requestedUUID); client.SendImageNotFound(m_requestedUUID);
m_log.WarnFormat("[TEXTURE]: Got null Data element on a asset {0}.. and the missing image Data property is al", m_requestedUUID); m_log.WarnFormat("[TEXTURE]: Got null Data element on a asset {0}.. and the missing image Data property is also null", m_requestedUUID);
return true; return true;
} }
// Do we have less then 1 packet's worth of data? // Do we have less then 1 packet's worth of data?
@ -374,8 +374,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (asset == null || asset.Data == null) if (asset == null || asset.Data == null)
{ {
m_asset = null; if (m_imageManager.MissingImage != null)
m_decoded = true; {
m_asset = m_imageManager.MissingImage;
m_assetDataLength = m_asset.Data.Length;
}
else
{
m_asset = null;
m_decoded = true;
}
} }
else else
{ {

View File

@ -141,7 +141,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected int m_primTerseUpdateRate = 10; protected int m_primTerseUpdateRate = 10;
protected int m_primFullUpdateRate = 14; protected int m_primFullUpdateRate = 14;
protected int m_textureSendLimit = 100; protected int m_textureSendLimit = 20;
protected int m_textureDataLimit = 10; protected int m_textureDataLimit = 10;
protected int m_packetMTU = 1400; protected int m_packetMTU = 1400;
@ -3139,7 +3139,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
switch (queue) switch (queue)
{ {
case ThrottleOutPacketType.Texture: case ThrottleOutPacketType.Texture:
m_log.Debug("Texture queue empty");
ProcessTextureRequests(); ProcessTextureRequests();
break; break;
} }

View File

@ -52,6 +52,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_shuttingdown = false; private bool m_shuttingdown = false;
private long m_lastloopprocessed = 0; private long m_lastloopprocessed = 0;
private AssetBase m_missingImage = null;
private LLClientView m_client; //Client we're assigned to private LLClientView m_client; //Client we're assigned to
private IAssetService m_assetCache; //Asset Cache private IAssetService m_assetCache; //Asset Cache
@ -62,6 +63,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
m_client = client; m_client = client;
m_assetCache = pAssetCache; 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; m_j2kDecodeModule = pJ2kDecodeModule;
} }
@ -70,6 +76,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
get { return m_client; } get { return m_client; }
} }
public AssetBase MissingImage
{
get { return m_missingImage; }
}
public void EnqueueReq(TextureRequestArgs newRequest) public void EnqueueReq(TextureRequestArgs newRequest)
{ {
//newRequest is the properties of our new texture fetch request. //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) public bool ProcessImageQueue(int count, int maxpack)
{ {
//count is the number of textures we want to process in one go. lock (this)
//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;
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) //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; 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 int numCollected = 0;
throttleseconds = throttleseconds / 1000;
//Safe-zone multiplier of 2.0 //Calculate our threshold
threshold = (int)(throttleseconds * 2.0); int threshold;
m_lastloopprocessed = DateTime.Now.Ticks; if (m_lastloopprocessed == 0)
}
if (m_client.PacketHandler == null)
return false;
if (m_client.PacketHandler.PacketQueue == null)
return false;
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)
{ {
J2KImage imagereq = null; if (m_client.PacketHandler == null || m_client.PacketHandler.PacketQueue == null || m_client.PacketHandler.PacketQueue.TextureThrottle == null)
lock (m_priorityQueue) return false;
imagereq = m_priorityQueue.FindMax(); //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;
if (imagereq.m_decoded == true) m_lastloopprocessed = DateTime.Now.Ticks;
{
// 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) { }
}
}
if (numCollected == count)
break;
} }
} else
{
double throttleseconds = ((double)DateTime.Now.Ticks - (double)m_lastloopprocessed) / (double)TimeSpan.TicksPerSecond;
throttleseconds = throttleseconds * m_client.PacketHandler.PacketQueue.TextureThrottle.Current;
return m_priorityQueue.Count > 0; //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;
}
if (m_client.PacketHandler == null)
return false;
if (m_client.PacketHandler.PacketQueue == null)
return false;
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 (true) //m_client.PacketHandler.PacketQueue.GetQueueCount(ThrottleOutPacketType.Texture) < threshold)
{
while (m_priorityQueue.Count > 0)
{
J2KImage imagereq = null;
lock (m_priorityQueue)
imagereq = m_priorityQueue.FindMax();
if (imagereq.m_decoded == true)
{
// 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) { }
}
}
if (numCollected == count)
break;
}
}
return m_priorityQueue.Count > 0;
}
} }
//Faux destructor //Faux destructor