* Adding request time limiting strategy for texture requests, though this isn't useable yet

This commit is contained in:
Justin Clarke Casey
2008-04-03 15:28:50 +00:00
parent 6ef4f1bdae
commit 5fe4a39927
3 changed files with 153 additions and 5 deletions

View File

@@ -50,12 +50,16 @@ namespace OpenSim.Region.Environment.Modules
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// We will allow the client to request the same texture n times before dropping further requests
/// We will allow the client to request the same missing texture n times before dropping further requests
///
/// This number includes repeated requests for the same texture at different resolutions (which we don't
/// currently handle properly as far as I know). However, this situation should be handled in a more
/// sophisticated way.
/// </summary>
private static readonly int MAX_ALLOWED_TEXTURE_REQUESTS = 5;
/// <summary>
/// We're going to limit repeated requests for the same missing texture.
/// 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
/// </summary>
@@ -63,10 +67,10 @@ namespace OpenSim.Region.Environment.Modules
= new RepeatLimitStrategy<LLUUID>(MAX_ALLOWED_TEXTURE_REQUESTS);
/// <summary>
/// XXX Also going to limit repeated requests for found textures.
/// XXX Also going to limit requests for found textures.
/// </summary>
private readonly IRequestLimitStrategy<LLUUID> foundTextureLimitStrategy
= new RepeatLimitStrategy<LLUUID>(MAX_ALLOWED_TEXTURE_REQUESTS);
= new RepeatLimitStrategy<LLUUID>(MAX_ALLOWED_TEXTURE_REQUESTS);
/// <summary>
/// Holds texture senders before they have received the appropriate texture from the asset cache.
@@ -115,6 +119,10 @@ namespace OpenSim.Region.Environment.Modules
{
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))