From 3a64522267352d1c68ef99ac76c65bd3c4f9eaf1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jan 2012 21:40:15 +0000 Subject: Minor formatting changes and commented out log lines for future debugging of image manager (udp texture fetch). No significant functional changes. --- OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 24 +++++--- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- .../ClientStack/Linden/UDP/LLImageManager.cs | 72 ++++++++++++++++++---- 3 files changed, 76 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index cb9692a..185a909 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs @@ -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); } + /// + /// 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 + /// 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); - } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index fe28ba3..eb1a50e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -577,7 +577,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Add a handler for the given packet type. /// /// - /// 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. /// /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index e3a881f..3e31b7d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs @@ -84,7 +84,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// 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(); +// 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; -- cgit v1.1