From 06f0515d144bc80ce6c502942a5f549d5a9c0ed6 Mon Sep 17 00:00:00 2001 From: diva Date: Sat, 18 Apr 2009 22:46:48 +0000 Subject: Bug fix in HG asset posts. Get the inner assets not just from mem cache but from asset service, because the inner ones may not be in mem cache. --- .../Framework/Scenes/Hypergrid/HGAssetMapper.cs | 42 ++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs index 48ea519..5242285 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs @@ -153,10 +153,11 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid return false; } - private bool PostAsset(GridAssetClient asscli, UUID assetID) + private bool PostAsset(GridAssetClient asscli, UUID assetID, bool isTexture) { AssetBase asset1; - m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset1); + //m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset1); + asset1 = m_scene.CommsManager.AssetCache.GetAsset(assetID, isTexture); if (asset1 != null) { @@ -377,25 +378,30 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid m_assetServers.Add(userAssetURL, asscli); } m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL); - bool success = PostAsset(asscli, assetID); - - // Now the inside - Dictionary ids = SniffUUIDs(assetID); - Dump(ids); - foreach (KeyValuePair kvp in ids) - PostAsset(asscli, kvp.Key); - - if (success) + AssetBase ass1 = null; + m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out ass1); + if (ass1 != null) { - m_log.Debug("[HGScene]: Successfully posted item to remote asset server " + userAssetURL); - if (!m_assetMap.ContainsKey(assetID)) - m_assetMap.Add(assetID, asscli); + bool success = PostAsset(asscli, assetID, (ass1.Type == (sbyte)AssetType.Texture)); + + // Now the inside + Dictionary ids = SniffUUIDs(assetID); + Dump(ids); + foreach (KeyValuePair kvp in ids) + PostAsset(asscli, kvp.Key, kvp.Value); + + if (success) + { + m_log.Debug("[HGScene]: Successfully posted item to remote asset server " + userAssetURL); + if (!m_assetMap.ContainsKey(assetID)) + m_assetMap.Add(assetID, asscli); + } + else + m_log.Warn("[HGScene]: Could not post asset to remote asset server " + userAssetURL); + } else - m_log.Warn("[HGScene]: Could not post asset to remote asset server " + userAssetURL); - - //if (!m_assetMap.ContainsKey(itemID)) - // m_assetMap.Add(itemID, asscli); + m_log.Debug("[HGScene]: Something wrong with asset"); } else m_log.Warn("[HGScene]: Unable to locate foreign user's asset server"); -- cgit v1.1