From be20f41637b6c06ce3ab16bc25851b6e43468e12 Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Wed, 30 Apr 2008 21:43:47 +0000
Subject: * Cruft removal step #1. Cleaning Modules directory.
---
.../TextureDownload/UserTextureDownloadService.cs | 85 +++++++++++-----------
1 file changed, 41 insertions(+), 44 deletions(-)
(limited to 'OpenSim/Region/Environment/Modules/Agent/TextureDownload/UserTextureDownloadService.cs')
diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/UserTextureDownloadService.cs b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/UserTextureDownloadService.cs
index 08a22d6..4f63fd0 100644
--- a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/UserTextureDownloadService.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/UserTextureDownloadService.cs
@@ -32,8 +32,6 @@ using log4net;
using OpenSim.Framework;
using OpenSim.Framework.Communications.Limit;
using OpenSim.Region.Environment.Interfaces;
-using OpenSim.Region.Environment.Modules.Agent.TextureDownload;
-using OpenSim.Region.Environment.Modules.Agent.TextureSender;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
@@ -45,7 +43,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
///
public class UserTextureDownloadService
{
- private static readonly ILog m_log
+ private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
///
@@ -56,35 +54,34 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
/// sophisticated way.
///
private static readonly int MAX_ALLOWED_TEXTURE_REQUESTS = 5;
-
- ///
- /// We're going to limit requests for the same missing texture.
- /// XXX This is really a temporary solution to deal with the situation where a client continually requests
- /// the same missing textures
- ///
- private readonly IRequestLimitStrategy missingTextureLimitStrategy
- = new RepeatLimitStrategy(MAX_ALLOWED_TEXTURE_REQUESTS);
-
+
///
/// XXX Also going to limit requests for found textures.
///
- private readonly IRequestLimitStrategy foundTextureLimitStrategy
- = new RepeatLimitStrategy(MAX_ALLOWED_TEXTURE_REQUESTS);
-
- ///
- /// Holds texture senders before they have received the appropriate texture from the asset cache.
- ///
- private readonly Dictionary m_textureSenders = new Dictionary();
-
+ private readonly IRequestLimitStrategy foundTextureLimitStrategy
+ = new RepeatLimitStrategy(MAX_ALLOWED_TEXTURE_REQUESTS);
+
+ private readonly IClientAPI m_client;
+ private readonly Scene m_scene;
+
///
/// Texture Senders are placed in this queue once they have received their texture from the asset
/// cache. Another module actually invokes the send.
///
private readonly BlockingQueue m_sharedSendersQueue;
-
- private readonly Scene m_scene;
-
- private readonly IClientAPI m_client;
+
+ ///
+ /// Holds texture senders before they have received the appropriate texture from the asset cache.
+ ///
+ private readonly Dictionary m_textureSenders = new Dictionary();
+
+ ///
+ /// We're going to limit requests for the same missing texture.
+ /// XXX This is really a temporary solution to deal with the situation where a client continually requests
+ /// the same missing textures
+ ///
+ private readonly IRequestLimitStrategy missingTextureLimitStrategy
+ = new RepeatLimitStrategy(MAX_ALLOWED_TEXTURE_REQUESTS);
public UserTextureDownloadService(
IClientAPI client, Scene scene, BlockingQueue sharedQueue)
@@ -112,19 +109,19 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
{
// 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);
+ textureSender.UpdateRequest(e.DiscardLevel, e.PacketNumber);
}
else
- {
+ {
if (!foundTextureLimitStrategy.AllowRequest(e.RequestedAssetID))
{
// m_log.DebugFormat(
// "[USER TEXTURE DOWNLOAD SERVICE]: Refusing request for {0} from client {1}",
// e.RequestedAssetID, m_client.AgentId);
-
+
return;
}
- else if (!missingTextureLimitStrategy.AllowRequest(e.RequestedAssetID))
+ else if (!missingTextureLimitStrategy.AllowRequest(e.RequestedAssetID))
{
if (missingTextureLimitStrategy.IsFirstRefusal(e.RequestedAssetID))
{
@@ -135,17 +132,17 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
// m_log.DebugFormat(
// "[USER TEXTURE DOWNLOAD SERVICE]: Dropping requests for notified missing texture {0} for client {1} since we have received more than {2} requests",
// e.RequestedAssetID, m_client.AgentId, MAX_ALLOWED_TEXTURE_REQUESTS);
- }
-
- return;
+ }
+
+ return;
}
-
+
m_scene.AddPendingDownloads(1);
-
- TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber);
+
+ TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber);
m_textureSenders.Add(e.RequestedAssetID, requestHandler);
-
- m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true);
+
+ m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true);
}
}
}
@@ -170,7 +167,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
public void TextureCallback(LLUUID textureID, AssetBase texture)
{
//m_log.DebugFormat("[USER TEXTURE DOWNLOAD SERVICE]: Calling TextureCallback with {0}, texture == null is {1}", textureID, (texture == null ? true : false));
-
+
lock (m_textureSenders)
{
TextureSender.TextureSender textureSender;
@@ -181,18 +178,18 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
// this on to the TextureSender it will blow up, so just discard for now.
// Needs investigation.
if (texture == null || texture.Data == null)
- {
+ {
if (!missingTextureLimitStrategy.IsMonitoringRequests(textureID))
{
missingTextureLimitStrategy.MonitorRequests(textureID);
m_log.DebugFormat(
- "[USER TEXTURE DOWNLOAD SERVICE]: Queueing first TextureNotFoundSender for {0}, client {1}",
+ "[USER TEXTURE DOWNLOAD SERVICE]: Queueing first TextureNotFoundSender for {0}, client {1}",
textureID, m_client.AgentId);
}
-
+
ITextureSender textureNotFoundSender = new TextureNotFoundSender(m_client, textureID);
- EnqueueTextureSender(textureNotFoundSender);
+ EnqueueTextureSender(textureNotFoundSender);
}
else
{
@@ -200,13 +197,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
{
textureSender.TextureReceived(texture);
EnqueueTextureSender(textureSender);
-
+
foundTextureLimitStrategy.MonitorRequests(textureID);
}
}
//m_log.InfoFormat("[TEXTURE SENDER] Removing texture sender with uuid {0}", textureID);
- m_textureSenders.Remove(textureID);
+ m_textureSenders.Remove(textureID);
//m_log.InfoFormat("[TEXTURE SENDER] Current texture senders in dictionary: {0}", m_textureSenders.Count);
}
else
@@ -240,7 +237,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
{
lock (m_textureSenders)
{
- foreach( TextureSender.TextureSender textureSender in m_textureSenders.Values )
+ foreach (TextureSender.TextureSender textureSender in m_textureSenders.Values)
{
textureSender.Cancel = true;
}
--
cgit v1.1