aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2012-09-21 15:55:58 -0700
committerDiva Canto2012-09-21 15:55:58 -0700
commitfb2ace6fff788b18df070933f8f80ee2d2fc1679 (patch)
tree2d0e343e60ef56babcf92f660c5cdda9d5d7ce49 /OpenSim
parentMinor: may avoid crashes of sims that still don't have this configuration sec... (diff)
downloadopensim-SC_OLD-fb2ace6fff788b18df070933f8f80ee2d2fc1679.zip
opensim-SC_OLD-fb2ace6fff788b18df070933f8f80ee2d2fc1679.tar.gz
opensim-SC_OLD-fb2ace6fff788b18df070933f8f80ee2d2fc1679.tar.bz2
opensim-SC_OLD-fb2ace6fff788b18df070933f8f80ee2d2fc1679.tar.xz
Removed redundant asset fetches on HGAssetMapper. The UuidGatherer already downloads the assets, so we don't need to do it again...
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs42
1 files changed, 24 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index 144cc87..dd0ea1c 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -71,6 +71,21 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
71 71
72 #region Internal functions 72 #region Internal functions
73 73
74 public AssetMetadata FetchMetadata(string url, UUID assetID)
75 {
76 if (!url.EndsWith("/") && !url.EndsWith("="))
77 url = url + "/";
78
79 AssetMetadata meta = m_scene.AssetService.GetMetadata(url + assetID.ToString());
80
81 if (meta != null)
82 m_log.DebugFormat("[HG ASSET MAPPER]: Fetched metadata for asset {0} of type {1} from {2} ", assetID, meta.Type, url);
83 else
84 m_log.DebugFormat("[HG ASSET MAPPER]: Unable to fetched metadata for asset {0} from {1} ", assetID, url);
85
86 return meta;
87 }
88
74 public AssetBase FetchAsset(string url, UUID assetID) 89 public AssetBase FetchAsset(string url, UUID assetID)
75 { 90 {
76 if (!url.EndsWith("/") && !url.EndsWith("=")) 91 if (!url.EndsWith("/") && !url.EndsWith("="))
@@ -222,28 +237,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
222 237
223 public void Get(UUID assetID, UUID ownerID, string userAssetURL) 238 public void Get(UUID assetID, UUID ownerID, string userAssetURL)
224 { 239 {
225 // Get the item from the remote asset server onto the local AssetCache 240 // Get the item from the remote asset server onto the local AssetService
226 // and place an entry in m_assetMap
227 241
228 m_log.Debug("[HG ASSET MAPPER]: Fetching object " + assetID + " from asset server " + userAssetURL); 242 AssetMetadata meta = FetchMetadata(userAssetURL, assetID);
229 AssetBase asset = FetchAsset(userAssetURL, assetID); 243 if (meta == null)
244 return;
230 245
231 if (asset != null) 246 // The act of gathering UUIDs downloads the assets from the remote server
232 { 247 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
233 // OK, now fetch the inside. 248 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
234 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); 249 uuidGatherer.GatherAssetUuids(assetID, (AssetType)meta.Type, ids);
235 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
236 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
237 if (ids.ContainsKey(assetID))
238 ids.Remove(assetID);
239 foreach (UUID uuid in ids.Keys)
240 FetchAsset(userAssetURL, uuid);
241 250
242 m_log.DebugFormat("[HG ASSET MAPPER]: Successfully fetched asset {0} from asset server {1}", asset.ID, userAssetURL); 251 m_log.DebugFormat("[HG ASSET MAPPER]: Successfully fetched asset {0} from asset server {1}", assetID, userAssetURL);
243 252
244 }
245 else
246 m_log.Warn("[HG ASSET MAPPER]: Could not fetch asset from remote asset server " + userAssetURL);
247 } 253 }
248 254
249 255