* 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> /// </summary>
private Dictionary<LLUUID, TextureImage> Textures; private Dictionary<LLUUID, TextureImage> Textures;
/// /// <summary>
/// Assets requests which are waiting for asset server data. This includes texture requests /// Assets requests which are waiting for asset server data. This includes texture requests
/// </summary> /// </summary>
private Dictionary<LLUUID, AssetRequest> RequestedAssets; private Dictionary<LLUUID, AssetRequest> RequestedAssets;
@ -75,7 +75,6 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary> /// </summary>
private List<AssetRequest> AssetRequests; private List<AssetRequest> AssetRequests;
/// <summary> /// <summary>
/// Until the asset request is fulfilled, each asset request is associated with a list of requesters /// Until the asset request is fulfilled, each asset request is associated with a list of requesters
/// </summary> /// </summary>
@ -166,11 +165,11 @@ namespace OpenSim.Framework.Communications.Cache
m_assetServer = assetServer; m_assetServer = assetServer;
m_assetServer.SetReceiver(this); m_assetServer.SetReceiver(this);
m_assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); m_assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
m_assetCacheThread.Name = "AssetCacheThread"; m_assetCacheThread.Name = "AssetCacheThread";
m_assetCacheThread.IsBackground = true; m_assetCacheThread.IsBackground = true;
m_assetCacheThread.Start(); m_assetCacheThread.Start();
ThreadTracker.Add(m_assetCacheThread); ThreadTracker.Add(m_assetCacheThread);
} }
/// <summary> /// <summary>
@ -452,10 +451,19 @@ namespace OpenSim.Framework.Communications.Cache
} }
// See IAssetReceiver // 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 // Notify requesters for this asset
AssetRequestsList reqList = null; AssetRequestsList reqList = null;
lock (RequestLists) lock (RequestLists)
@ -509,7 +517,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
/// <summary> /// <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> /// </summary>
/// <param name="userInfo"></param> /// <param name="userInfo"></param>
/// <param name="transferRequest"></param> /// <param name="transferRequest"></param>
@ -546,12 +554,21 @@ namespace OpenSim.Framework.Communications.Cache
RequestedAssets.Add(requestID, request); RequestedAssets.Add(requestID, request);
m_assetServer.RequestAsset(requestID, false); m_assetServer.RequestAsset(requestID, false);
} }
return; return;
} }
//it is in our cache
// It has an entry in our cache
AssetInfo asset = Assets[requestID]; 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(); AssetRequest req = new AssetRequest();
req.RequestUser = userInfo; req.RequestUser = userInfo;
req.RequestAssetID = requestID; 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_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 /// Call back made when an asset server could not retrieve a requested asset
/// </summary> /// </summary>
/// <param name="assetID"></param> /// <param name="assetID"></param>
void AssetNotFound(LLUUID assetID); /// <param name="IsTexture"></param>
void AssetNotFound(LLUUID assetID, bool IsTexture);
} }
public interface IAssetPlugin public interface IAssetPlugin