From cd1978b424d1db17fd40e72407d5371c3c56e6ae Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 17 Mar 2008 17:30:01 +0000 Subject: [PATCH] * Reduce the annoyingness of clients that continually request unfound textures (probably for some good reason) by dropping all subsequent requests after the first reply. * Print out a console message every 20 tries rather than every single one. * This weakens the problem but does not eliminate it --- .../Modules/UserTextureDownloadService.cs | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs index 6467ea3744..6eaf3210b9 100644 --- a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs +++ b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs @@ -60,6 +60,13 @@ namespace OpenSim.Region.Environment.Modules /// private readonly BlockingQueue m_sharedSendersQueue; + /// + /// We're going to record when we get a request for a particular missing texture for each client + /// XXX This is really a temporary solution to deal with the situation where a client continually requests + /// the same missing textures + /// + private readonly Dictionary missingTextureRequests = new Dictionary(); + private readonly Scene m_scene; private readonly IClientAPI m_client; @@ -138,12 +145,33 @@ namespace OpenSim.Region.Environment.Modules // Needs investigation. if (texture == null || texture.Data == null) { - m_log.DebugFormat( - "[USER TEXTURE DOWNLOAD SERVICE]: Queueing TextureNotFoundSender for {0}, client {1}", - textureID, m_client.AgentId); - - ITextureSender textureNotFoundSender = new TextureNotFoundSender(m_client, textureID); - EnqueueTextureSender(textureNotFoundSender); + // We're only going to tell the client once about a missing texture, even if it keeps asking + // XXX This is to reduce (but not resolve) a current problem where some clients keep requesting the same textures + // - one might want to do this for all asset requests (or allow a number of retries) in the + // longer term. + if (!missingTextureRequests.ContainsKey(textureID)) + { + m_log.DebugFormat( + "[USER TEXTURE DOWNLOAD SERVICE]: Queueing TextureNotFoundSender for {0}, client {1}", + textureID, m_client.AgentId); + + ITextureSender textureNotFoundSender = new TextureNotFoundSender(m_client, textureID); + 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 {