Minor formatting changes and commented out log lines for future debugging of image manager (udp texture fetch). No significant functional changes.

iar_mods
Justin Clark-Casey (justincc) 2012-01-04 21:40:15 +00:00
parent aa625da6a6
commit 3a64522267
4 changed files with 80 additions and 22 deletions

View File

@ -102,7 +102,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
m_currentPacket = 2;
}
while (sendMore && packetsSent < packetsToSend && m_currentPacket <= m_stopPacket)
{
sendMore = SendPacket(client);
@ -114,17 +114,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return (m_currentPacket > m_stopPacket);
}
/// <summary>
/// This is where we decide what we need to update
/// and assign the real discardLevel and packetNumber
/// assuming of course that the connected client might be bonkers
/// </summary>
public void RunUpdate()
{
//This is where we decide what we need to update
//and assign the real discardLevel and packetNumber
//assuming of course that the connected client might be bonkers
if (!HasAsset)
{
if (!m_assetRequested)
{
m_assetRequested = true;
// m_log.DebugFormat("[J2KIMAGE]: Requesting asset {0}", TextureID);
AssetService.Get(TextureID.ToString(), this, AssetReceived);
}
}
@ -137,6 +139,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
//Request decode
m_decodeRequested = true;
// m_log.DebugFormat("[J2KIMAGE]: Requesting decode of asset {0}", TextureID);
// Do we have a jpeg decoder?
if (J2KDecoder != null)
{
@ -149,7 +154,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Send it off to the jpeg decoder
J2KDecoder.BeginDecode(TextureID, m_asset, J2KDecodedCallback);
}
}
else
{
@ -328,14 +332,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (m_currentPacket == 0)
return 0;
if (m_currentPacket == 1)
return FIRST_PACKET_SIZE;
int result = FIRST_PACKET_SIZE + ((int)m_currentPacket - 2) * IMAGE_PACKET_SIZE;
if (result < 0)
{
result = FIRST_PACKET_SIZE;
}
return result;
}
@ -374,7 +379,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
UUID assetID = UUID.Zero;
if (asset != null)
{
assetID = asset.FullID;
}
else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule))
{
// Unfortunately we need this here, there's no other way.
@ -395,7 +402,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
AssetDataCallback(assetID, asset);
}
}
}

View File

@ -577,7 +577,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// Add a handler for the given packet type.
/// </summary>
/// <remarks>
/// The packet is handled on its own thread. If packets must be handled in the order in which thye
/// The packet is handled on its own thread. If packets must be handled in the order in which they
/// are received then please use the synchronous version of this method.
/// </remarks>
/// <param name="packetType"></param>

View File

@ -84,7 +84,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="newRequest"></param>
public void EnqueueReq(TextureRequestArgs newRequest)
{
//Make sure we're not shutting down..
if (!m_shuttingdown)
{
J2KImage imgrequest;
@ -99,19 +98,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
//m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID);
try
try
{
lock (m_syncRoot)
m_priorityQueue.Delete(imgrequest.PriorityQueueHandle);
m_priorityQueue.Delete(imgrequest.PriorityQueueHandle);
}
catch (Exception) { }
}
else
{
// m_log.DebugFormat(
// "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}",
// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name);
//m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}",
// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
//Check the packet sequence to make sure this isn't older than
//Check the packet sequence to make sure this isn't older than
//one we've already received
if (newRequest.requestSequence > imgrequest.LastSequence)
{
@ -126,11 +129,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//Update the requested priority
imgrequest.Priority = newRequest.Priority;
UpdateImageInQueue(imgrequest);
//Run an update
imgrequest.RunUpdate();
// J2KImage imgrequest2 = new J2KImage(this);
// imgrequest2.J2KDecoder = m_j2kDecodeModule;
// imgrequest2.AssetService = m_assetCache;
// imgrequest2.AgentID = m_client.AgentId;
// imgrequest2.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>();
// imgrequest2.DiscardLevel = newRequest.DiscardLevel;
// imgrequest2.StartPacket = Math.Max(1, newRequest.PacketNumber);
// imgrequest2.Priority = newRequest.Priority;
// imgrequest2.TextureID = newRequest.RequestedAssetID;
// imgrequest2.Priority = newRequest.Priority;
//
// //Add this download to the priority queue
// AddImageToQueue(imgrequest2);
//
// imgrequest2.RunUpdate();
}
// else
// {
// m_log.DebugFormat(
// "[LL IMAGE MANAGER]: Ignoring duplicate of existing request for {0} (sequence {1}) from {2} as its request sequence {3} is not greater",
// newRequest.RequestedAssetID, imgrequest.LastSequence, m_client.Name, newRequest.requestSequence);
// }
}
}
else
@ -142,6 +168,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else
{
// m_log.DebugFormat(
// "[LL IMAGE MANAGER]: Received request for {0}, start packet {1} from {2}",
// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name);
//m_log.DebugFormat("[TEX]: (NEW) ID={0}: D={1}, S={2}, P={3}",
// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
@ -159,7 +189,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//Add this download to the priority queue
AddImageToQueue(imgrequest);
//Run an update
imgrequest.RunUpdate();
}
}
@ -176,7 +205,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// If null was returned, the texture priority queue is currently empty
if (image == null)
return false;
break;
if (image.IsDecoded)
{
@ -194,10 +223,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// 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;
// m_log.DebugFormat(
// "[LL IMAGE MANAGER]: Exiting image queue processing early on encountering undecoded image {0}",
// image.TextureID);
break;
}
}
// if (packetsSent != 0)
// m_log.DebugFormat("[LL IMAGE MANAGER]: Processed {0} packets from image queue", packetsSent);
return m_priorityQueue.Count > 0;
}
@ -219,7 +255,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (m_priorityQueue.Count > 0)
{
try { image = m_priorityQueue.FindMax(); }
try
{
image = m_priorityQueue.FindMax();
}
catch (Exception) { }
}
}
@ -232,7 +271,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
lock (m_syncRoot)
{
try { m_priorityQueue.Add(ref image.PriorityQueueHandle, image); }
try
{
m_priorityQueue.Add(ref image.PriorityQueueHandle, image);
}
catch (Exception) { }
}
}
@ -241,7 +283,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
lock (m_syncRoot)
{
try { m_priorityQueue.Delete(image.PriorityQueueHandle); }
try
{
m_priorityQueue.Delete(image.PriorityQueueHandle);
}
catch (Exception) { }
}
}
@ -250,7 +295,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
lock (m_syncRoot)
{
try { m_priorityQueue.Replace(image.PriorityQueueHandle, image); }
try
{
m_priorityQueue.Replace(image.PriorityQueueHandle, image);
}
catch (Exception)
{
image.PriorityQueueHandle = null;

View File

@ -103,6 +103,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
// If it's cached, return the cached results
if (m_decodedCache.TryGetValue(assetID, out result))
{
// m_log.DebugFormat(
// "[J2KDecoderModule]: Returning existing cached {0} layers j2k decode for {1}",
// result.Length, assetID);
callback(assetID, result);
}
else