From 7d7ad4dff205faf64116defdc25f2d484cd04589 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 20 Feb 2008 20:23:03 +0000 Subject: * Only count download requests for assets which are not already waiting for data from the asset server * This should stop the constant increase in the download requests statistics * If you see stat numbers for download requests which are far from what you'd expect, please report --- .../Environment/Modules/TextureDownloadModule.cs | 8 ++++---- OpenSim/Region/Environment/Modules/TextureSender.cs | 2 ++ .../Environment/Modules/UserTextureDownloadService.cs | 19 +++++++++---------- OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs index 0473c09..531d4ff 100644 --- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs @@ -13,7 +13,7 @@ * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY @@ -161,7 +161,6 @@ namespace OpenSim.Region.Environment.Modules if (TryGetUserTextureService(client.AgentId, out textureService)) { textureService.HandleTextureRequest(client, e); - m_scene.AddPendingDownloads(1); } } @@ -208,8 +207,9 @@ namespace OpenSim.Region.Environment.Modules /// private void TextureSent(TextureSender sender) { - sender.Sending = false; - m_scene.AddPendingDownloads(-1); + sender.Sending = false; + //m_log.DebugFormat("[TEXTURE DOWNLOAD]: Removing download stat for {0}", sender.assetID); + m_scene.AddPendingDownloads(-1); } } } diff --git a/OpenSim/Region/Environment/Modules/TextureSender.cs b/OpenSim/Region/Environment/Modules/TextureSender.cs index f2b3173..056b8e1 100644 --- a/OpenSim/Region/Environment/Modules/TextureSender.cs +++ b/OpenSim/Region/Environment/Modules/TextureSender.cs @@ -53,6 +53,8 @@ namespace OpenSim.Region.Environment.Modules /// private AssetBase m_asset; + //public LLUUID assetID { get { return m_asset.FullID; } } + /// /// This is actually the number of extra packets required to send the texture data! We always assume /// at least one is required. diff --git a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs index 2f08bd6..bd5ee0b5 100644 --- a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs +++ b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs @@ -42,8 +42,8 @@ namespace OpenSim.Region.Environment.Modules /// public class UserTextureDownloadService { - //private static readonly log4net.ILog m_log - // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private static readonly log4net.ILog m_log + = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); /// /// Holds texture senders before they have received the appropriate texture from the asset cache. @@ -81,16 +81,15 @@ namespace OpenSim.Region.Environment.Modules { if (m_textureSenders.TryGetValue(e.RequestedAssetID, out textureSender)) { - textureSender.UpdateRequest(e.DiscardLevel, e.PacketNumber); - - if ((textureSender.ImageLoaded) && - (textureSender.Sending == false)) - { - EnqueueTextureSender(textureSender); - } + // If we've received new non UUID information for this request and it hasn't dispatched + // yet, then update the request accordingly. + textureSender.UpdateRequest(e.DiscardLevel, e.PacketNumber); } else { + //m_log.DebugFormat("[USER TEXTURE DOWNLOAD]: Adding download stat {0}", e.RequestedAssetID); + m_scene.AddPendingDownloads(1); + TextureSender requestHandler = new TextureSender(client, e.DiscardLevel, e.PacketNumber); m_textureSenders.Add(e.RequestedAssetID, requestHandler); @@ -141,7 +140,7 @@ namespace OpenSim.Region.Environment.Modules // TODO Send packet back to the client telling it not to expect the texture // The absence of this packet doesn't appear to be causing it a problem right now - //m_log.InfoFormat("Removing {0} from pending downloads count", textureID); + //m_log.DebugFormat("[USER TEXTURE DOWNLOAD]: Removing download stat for {0}", textureID); m_scene.AddPendingDownloads(-1); } diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index 422189e..90e09b0 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs @@ -370,7 +370,7 @@ namespace OpenSim.Region.Environment.Scenes public void addPendingDownload(int count) { m_pendingDownloads += count; - //m_log.InfoFormat("Adding {0} to pending downloads to make {1}", count, m_pendingDownloads); + //m_log.InfoFormat("[stats]: Adding {0} to pending downloads to make {1}", count, m_pendingDownloads); } public void addScriptLines(int count) -- cgit v1.1