* Cache knowledge in the region server that the asset service has reported an asset to be missing

* This prevents repeated requests for the same missing asset to the asset server, hopefully reducing the load a little
0.6.0-stable
Justin Clarke Casey 2008-05-16 17:47:34 +00:00
parent 772f88d2e5
commit c2581c9577
3 changed files with 33 additions and 15 deletions

View File

@ -65,7 +65,7 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary>
private Dictionary<LLUUID, TextureImage> Textures;
///
/// <summary>
/// Assets requests which are waiting for asset server data. This includes texture requests
/// </summary>
private Dictionary<LLUUID, AssetRequest> RequestedAssets;
@ -75,7 +75,6 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary>
private List<AssetRequest> AssetRequests;
/// <summary>
/// Until the asset request is fulfilled, each asset request is associated with a list of requesters
/// </summary>
@ -166,11 +165,11 @@ namespace OpenSim.Framework.Communications.Cache
m_assetServer = assetServer;
m_assetServer.SetReceiver(this);
m_assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
m_assetCacheThread.Name = "AssetCacheThread";
m_assetCacheThread.IsBackground = true;
m_assetCacheThread.Start();
ThreadTracker.Add(m_assetCacheThread);
m_assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
m_assetCacheThread.Name = "AssetCacheThread";
m_assetCacheThread.IsBackground = true;
m_assetCacheThread.Start();
ThreadTracker.Add(m_assetCacheThread);
}
/// <summary>
@ -452,10 +451,19 @@ namespace OpenSim.Framework.Communications.Cache
}
// See IAssetReceiver
public void AssetNotFound(LLUUID assetID)
public void AssetNotFound(LLUUID assetID, bool IsTexture)
{
// m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID);
m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID);
if (IsTexture)
{
Textures[assetID] = null;
}
else
{
Assets[assetID] = null;
}
// Notify requesters for this asset
AssetRequestsList reqList = null;
lock (RequestLists)
@ -509,7 +517,7 @@ namespace OpenSim.Framework.Communications.Cache
}
/// <summary>
/// Make an asset request the result of which will be packeted up and sent directly back to the client.
/// Handle an asset request from the client. The result will be sent back asynchronously.
/// </summary>
/// <param name="userInfo"></param>
/// <param name="transferRequest"></param>
@ -546,12 +554,21 @@ namespace OpenSim.Framework.Communications.Cache
RequestedAssets.Add(requestID, request);
m_assetServer.RequestAsset(requestID, false);
}
return;
}
//it is in our cache
// It has an entry in our cache
AssetInfo asset = Assets[requestID];
// add to the AssetRequests list
// FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right.
if (null == asset)
{
m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing", requestID);
return;
}
// The asset is knosn to exist and is in our cache, so add it to the AssetRequests list
AssetRequest req = new AssetRequest();
req.RequestUser = userInfo;
req.RequestAssetID = requestID;

View File

@ -78,7 +78,7 @@ namespace OpenSim.Framework.Communications.Cache
{
//m_log.ErrorFormat("[ASSET SERVER]: Asset {0} not found by asset server", req.AssetID);
m_receiver.AssetNotFound(req.AssetID);
m_receiver.AssetNotFound(req.AssetID, req.IsTexture);
}
}

View File

@ -58,7 +58,8 @@ namespace OpenSim.Framework
/// Call back made when an asset server could not retrieve a requested asset
/// </summary>
/// <param name="assetID"></param>
void AssetNotFound(LLUUID assetID);
/// <param name="IsTexture"></param>
void AssetNotFound(LLUUID assetID, bool IsTexture);
}
public interface IAssetPlugin