minor refactor

afrisby
Justin Clarke Casey 2007-12-22 16:45:44 +00:00
parent e52c217e44
commit ed0f8bd572
4 changed files with 13 additions and 6 deletions

View File

@ -34,7 +34,7 @@ namespace OpenSim.Framework
{ {
private Queue<T> _queue = new Queue<T>(); private Queue<T> _queue = new Queue<T>();
private object _queueSync = new object(); private object _queueSync = new object();
public void Enqueue(T value) public void Enqueue(T value)
{ {
lock (_queueSync) lock (_queueSync)

View File

@ -98,7 +98,12 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
public AssetBase GetAsset(LLUUID assetID) /// <summary>
/// Only get an asset if we already have it in the cache.
/// </summary>
/// <param name="assetID"></param></param>
/// <returns></returns>
private AssetBase GetCachedAsset(LLUUID assetID)
{ {
AssetBase asset = null; AssetBase asset = null;
if (Textures.ContainsKey(assetID)) if (Textures.ContainsKey(assetID))
@ -153,7 +158,7 @@ namespace OpenSim.Framework.Communications.Cache
public AssetBase GetAsset(LLUUID assetID, bool isTexture) public AssetBase GetAsset(LLUUID assetID, bool isTexture)
{ {
AssetBase asset = GetAsset(assetID); AssetBase asset = GetCachedAsset(assetID);
if (asset == null) if (asset == null)
{ {
m_assetServer.RequestAsset(assetID, isTexture); m_assetServer.RequestAsset(assetID, isTexture);
@ -223,7 +228,7 @@ namespace OpenSim.Framework.Communications.Cache
public AssetBase CopyAsset(LLUUID assetID) public AssetBase CopyAsset(LLUUID assetID)
{ {
AssetBase asset = GetAsset(assetID); AssetBase asset = GetCachedAsset(assetID);
if (asset == null) if (asset == null)
return null; return null;

View File

@ -3106,7 +3106,7 @@ namespace OpenSim.Region.ClientStack
// Fetch landmark // Fetch landmark
LLUUID lmid = tpReq.Info.LandmarkID; LLUUID lmid = tpReq.Info.LandmarkID;
AssetBase lma = m_assetCache.GetAsset(lmid); AssetBase lma = m_assetCache.GetAsset(lmid, false);
if (lma != null) if (lma != null)
{ {
AssetLandmark lm = new AssetLandmark(lma); AssetLandmark lm = new AssetLandmark(lma);

View File

@ -146,7 +146,9 @@ namespace OpenSim.Region.Environment.Scenes
if (transactions != null) if (transactions != null)
{ {
LLUUID assetID = libsecondlife.LLUUID.Combine(transactionID, remoteClient.SecureSessionId); LLUUID assetID = libsecondlife.LLUUID.Combine(transactionID, remoteClient.SecureSessionId);
AssetBase asset = AssetCache.GetAsset(assetID); AssetBase asset
= AssetCache.GetAsset(
assetID, (item.assetType == (int)AssetType.Texture ? true : false));
if (asset == null) if (asset == null)
{ {