From f3190810d373b33bd7af5f909e840b8aaacd3e75 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 20 Feb 2008 19:13:59 +0000 Subject: [PATCH] * Properly guard removal of asset request lists on AssetCache.AssetNotFound (my own bug) --- .../Communications/Cache/AssetCache.cs | 20 ++++++++++--------- .../Communications/Cache/AssetServerBase.cs | 10 +++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 0d853450d9..0e31e95ed6 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -44,8 +44,8 @@ namespace OpenSim.Framework.Communications.Cache /// /// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either /// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and - /// sends packetised data directly back to the client. The only point where they meets is AssetReceived() and - /// AssetNotFound(). + /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and + /// AssetNotFound(), which means they do share the same asset and texture caches. /// /// TODO Assets in this cache are effectively immortal (they are never disposed off through old age). /// This is not a huge problem at the moment since other memory use usually dwarfs that used by assets @@ -469,7 +469,7 @@ namespace OpenSim.Framework.Communications.Cache // Notify requesters for this asset if (RequestLists.ContainsKey(asset.FullID)) - { + { lock (RequestLists) { AssetRequestsList reqList = RequestLists[asset.FullID]; @@ -513,14 +513,16 @@ namespace OpenSim.Framework.Communications.Cache // Notify requesters for this asset lock (RequestLists) { - AssetRequestsList reqList = RequestLists[assetID]; - foreach (NewAssetRequest req in reqList.Requests) + if (RequestLists.ContainsKey(assetID)) { - req.Callback(assetID, null); + AssetRequestsList reqList = RequestLists[assetID]; + foreach (NewAssetRequest req in reqList.Requests) + { + req.Callback(assetID, null); + } + + RequestLists.Remove(assetID); } - - RequestLists.Remove(assetID); - reqList.Requests.Clear(); } } diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs index b6ec898f3c..a3530bd76f 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs @@ -77,7 +77,7 @@ namespace OpenSim.Framework.Communications.Cache } else { - m_log.ErrorFormat("[ASSETSERVER]: 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); } @@ -85,7 +85,7 @@ namespace OpenSim.Framework.Communications.Cache public virtual void LoadDefaultAssets() { - m_log.Info("[ASSETSERVER]: Setting up asset database"); + m_log.Info("[ASSET SERVER]: Setting up asset database"); assetLoader.ForEachDefaultXmlAsset(StoreAsset); @@ -94,7 +94,7 @@ namespace OpenSim.Framework.Communications.Cache public AssetServerBase() { - m_log.Info("[ASSETSERVER]: Starting asset storage system"); + m_log.Info("[ASSET SERVER]: Starting asset storage system"); m_assetRequests = new BlockingQueue(); m_localAssetServerThread = new Thread(RunRequests); @@ -115,7 +115,7 @@ namespace OpenSim.Framework.Communications.Cache } catch (Exception e) { - m_log.Error("[ASSETSERVER]: " + e.Message); + m_log.Error("[ASSET SERVER]: " + e.ToString()); } } } @@ -136,7 +136,7 @@ namespace OpenSim.Framework.Communications.Cache req.IsTexture = isTexture; m_assetRequests.Enqueue(req); - m_log.InfoFormat("[ASSETSERVER]: Added {0} to request queue", assetID); + m_log.InfoFormat("[ASSET SERVER]: Added {0} to request queue", assetID); } public virtual void UpdateAsset(AssetBase asset)