From bbddc0dbe7553baebb13d1e1fd06a529d7fbaaa0 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 17 Mar 2008 21:44:54 +0000 Subject: [PATCH] * Move missing texture request forward so that we don't actually ask the AssetCache for it if we know it's missing. --- .../Modules/UserTextureDownloadService.cs | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs index 6eaf3210b9..e86e6ac534 100644 --- a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs +++ b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs @@ -101,14 +101,32 @@ namespace OpenSim.Region.Environment.Modules } else { - //m_log.DebugFormat("[USER TEXTURE DOWNLOAD]: Adding download stat {0}", e.RequestedAssetID); - m_scene.AddPendingDownloads(1); - - TextureSender requestHandler = - new TextureSender(m_client, e.DiscardLevel, e.PacketNumber); - m_textureSenders.Add(e.RequestedAssetID, requestHandler); - - m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true); + // If we've already told the client we're missing the texture, then don't ask the + // asset server for it again - record the fact that it's missing instead. + if (missingTextureRequests.ContainsKey(e.RequestedAssetID)) + { + int requests = missingTextureRequests[e.RequestedAssetID] + 1; + + if (requests % 20 == 0) + { + m_log.WarnFormat( + "[USER TEXTURE DOWNLOAD SERVICE]: Received {0} requests for the missing texture {1} from client {2}", + requests, e.RequestedAssetID, m_client.AgentId); + } + + missingTextureRequests[e.RequestedAssetID] = requests; + } + else + { + //m_log.DebugFormat("[USER TEXTURE DOWNLOAD]: Adding download stat {0}", e.RequestedAssetID); + m_scene.AddPendingDownloads(1); + + TextureSender requestHandler = + new TextureSender(m_client, e.DiscardLevel, e.PacketNumber); + m_textureSenders.Add(e.RequestedAssetID, requestHandler); + + m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true); + } } } } @@ -159,19 +177,6 @@ namespace OpenSim.Region.Environment.Modules EnqueueTextureSender(textureNotFoundSender); missingTextureRequests.Add(textureID, 1); } - else - { - int requests = missingTextureRequests[textureID] + 1; - - if (requests % 20 == 0) - { - m_log.WarnFormat( - "[USER TEXTURE DOWNLOAD SERVICE]: Received {0} requests for the missing texture {1} from client {2}", - requests, textureID, m_client.AgentId); - } - - missingTextureRequests[textureID] = requests; - } } else {