diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 24d5d00c40..6564b4d22f 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -776,8 +776,8 @@ namespace OpenSim.Region.CoreModules.Asset { UuidGatherer gatherer = new UuidGatherer(m_AssetService); - HashSet uniqueUuids = new HashSet(); - Dictionary assets = new Dictionary(); + Dictionary assetIdsToCheck = new Dictionary(); + Dictionary assetsFound = new Dictionary(); foreach (Scene s in m_Scenes) { @@ -785,33 +785,40 @@ namespace OpenSim.Region.CoreModules.Asset s.ForEachSOG(delegate(SceneObjectGroup e) { - gatherer.GatherAssetUuids(e, assets); + gatherer.GatherAssetUuids(e, assetIdsToCheck); - foreach (UUID assetID in assets.Keys) + foreach (UUID assetID in assetIdsToCheck.Keys) { - uniqueUuids.Add(assetID); - - string filename = GetFileName(assetID.ToString()); - - if (File.Exists(filename)) + if (!assetsFound.ContainsKey(assetID)) { - UpdateFileLastAccessTime(filename); + string filename = GetFileName(assetID.ToString()); + + if (File.Exists(filename)) + { + UpdateFileLastAccessTime(filename); + } + else if (storeUncached) + { + AssetBase cachedAsset = m_AssetService.Get(assetID.ToString()); + if (cachedAsset == null && assetIdsToCheck[assetID] != (sbyte)AssetType.Unknown) + assetsFound[assetID] = false; + else + assetsFound[assetID] = true; + } } - else if (storeUncached) + else if (!assetsFound[assetID]) { - AssetBase cachedAsset = m_AssetService.Get(assetID.ToString()); - if (cachedAsset == null && assets[assetID] != (sbyte)AssetType.Unknown) - m_log.DebugFormat( + m_log.DebugFormat( "[FLOTSAM ASSET CACHE]: Could not find asset {0}, type {1} referenced by object {2} at {3} in scene {4} when pre-caching all scene assets", - assetID, assets[assetID], e.Name, e.AbsolutePosition, s.Name); + assetID, assetIdsToCheck[assetID], e.Name, e.AbsolutePosition, s.Name); } } - assets.Clear(); + assetIdsToCheck.Clear(); }); } - return uniqueUuids.Count; + return assetsFound.Count; } ///