* Properly guard removal of asset request lists on AssetCache.AssetNotFound (my own bug)

ThreadPoolClientBranch
Justin Clarke Casey 2008-02-20 19:13:59 +00:00
parent 53d5aeec24
commit f3190810d3
2 changed files with 16 additions and 14 deletions

View File

@ -44,8 +44,8 @@ namespace OpenSim.Framework.Communications.Cache
/// ///
/// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either /// 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 /// 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 /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and
/// AssetNotFound(). /// 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). /// 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 /// 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 // Notify requesters for this asset
if (RequestLists.ContainsKey(asset.FullID)) if (RequestLists.ContainsKey(asset.FullID))
{ {
lock (RequestLists) lock (RequestLists)
{ {
AssetRequestsList reqList = RequestLists[asset.FullID]; AssetRequestsList reqList = RequestLists[asset.FullID];
@ -513,14 +513,16 @@ namespace OpenSim.Framework.Communications.Cache
// Notify requesters for this asset // Notify requesters for this asset
lock (RequestLists) lock (RequestLists)
{ {
AssetRequestsList reqList = RequestLists[assetID]; if (RequestLists.ContainsKey(assetID))
foreach (NewAssetRequest req in reqList.Requests)
{ {
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();
} }
} }

View File

@ -77,7 +77,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
else 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); m_receiver.AssetNotFound(req.AssetID);
} }
@ -85,7 +85,7 @@ namespace OpenSim.Framework.Communications.Cache
public virtual void LoadDefaultAssets() public virtual void LoadDefaultAssets()
{ {
m_log.Info("[ASSETSERVER]: Setting up asset database"); m_log.Info("[ASSET SERVER]: Setting up asset database");
assetLoader.ForEachDefaultXmlAsset(StoreAsset); assetLoader.ForEachDefaultXmlAsset(StoreAsset);
@ -94,7 +94,7 @@ namespace OpenSim.Framework.Communications.Cache
public AssetServerBase() public AssetServerBase()
{ {
m_log.Info("[ASSETSERVER]: Starting asset storage system"); m_log.Info("[ASSET SERVER]: Starting asset storage system");
m_assetRequests = new BlockingQueue<AssetRequest>(); m_assetRequests = new BlockingQueue<AssetRequest>();
m_localAssetServerThread = new Thread(RunRequests); m_localAssetServerThread = new Thread(RunRequests);
@ -115,7 +115,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
catch (Exception e) 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; req.IsTexture = isTexture;
m_assetRequests.Enqueue(req); 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) public virtual void UpdateAsset(AssetBase asset)