From ed0f8bd5728d0fbe992cc4a1d164983edda654e8 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sat, 22 Dec 2007 16:45:44 +0000 Subject: [PATCH] minor refactor --- OpenSim/Framework/BlockingQueue.cs | 2 +- OpenSim/Framework/Communications/Cache/AssetCache.cs | 11 ++++++++--- OpenSim/Region/ClientStack/ClientView.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 4 +++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs index dbd116bf58..a3cae63425 100644 --- a/OpenSim/Framework/BlockingQueue.cs +++ b/OpenSim/Framework/BlockingQueue.cs @@ -34,7 +34,7 @@ namespace OpenSim.Framework { private Queue _queue = new Queue(); private object _queueSync = new object(); - + public void Enqueue(T value) { lock (_queueSync) diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 99356c27e5..d1ff9c9211 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -98,7 +98,12 @@ namespace OpenSim.Framework.Communications.Cache } } - public AssetBase GetAsset(LLUUID assetID) + /// + /// Only get an asset if we already have it in the cache. + /// + /// + /// + private AssetBase GetCachedAsset(LLUUID assetID) { AssetBase asset = null; if (Textures.ContainsKey(assetID)) @@ -153,7 +158,7 @@ namespace OpenSim.Framework.Communications.Cache public AssetBase GetAsset(LLUUID assetID, bool isTexture) { - AssetBase asset = GetAsset(assetID); + AssetBase asset = GetCachedAsset(assetID); if (asset == null) { m_assetServer.RequestAsset(assetID, isTexture); @@ -223,7 +228,7 @@ namespace OpenSim.Framework.Communications.Cache public AssetBase CopyAsset(LLUUID assetID) { - AssetBase asset = GetAsset(assetID); + AssetBase asset = GetCachedAsset(assetID); if (asset == null) return null; diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 86591ec9cd..34a9b094e2 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -3106,7 +3106,7 @@ namespace OpenSim.Region.ClientStack // Fetch landmark LLUUID lmid = tpReq.Info.LandmarkID; - AssetBase lma = m_assetCache.GetAsset(lmid); + AssetBase lma = m_assetCache.GetAsset(lmid, false); if (lma != null) { AssetLandmark lm = new AssetLandmark(lma); diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 86cb38dad6..efd96d2e01 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -146,7 +146,9 @@ namespace OpenSim.Region.Environment.Scenes if (transactions != null) { 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) {