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.

0.6.5-rc1
diva 2009-04-18 22:46:48 +00:00
parent 5ae8ad55cd
commit 06f0515d14
1 changed files with 24 additions and 18 deletions

View File

@ -153,10 +153,11 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
return false; return false;
} }
private bool PostAsset(GridAssetClient asscli, UUID assetID) private bool PostAsset(GridAssetClient asscli, UUID assetID, bool isTexture)
{ {
AssetBase asset1; 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) if (asset1 != null)
{ {
@ -377,25 +378,30 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
m_assetServers.Add(userAssetURL, asscli); m_assetServers.Add(userAssetURL, asscli);
} }
m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL); m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL);
bool success = PostAsset(asscli, assetID); AssetBase ass1 = null;
m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out ass1);
// Now the inside if (ass1 != null)
Dictionary<UUID, bool> ids = SniffUUIDs(assetID);
Dump(ids);
foreach (KeyValuePair<UUID, bool> kvp in ids)
PostAsset(asscli, kvp.Key);
if (success)
{ {
m_log.Debug("[HGScene]: Successfully posted item to remote asset server " + userAssetURL); bool success = PostAsset(asscli, assetID, (ass1.Type == (sbyte)AssetType.Texture));
if (!m_assetMap.ContainsKey(assetID))
m_assetMap.Add(assetID, asscli); // Now the inside
Dictionary<UUID, bool> ids = SniffUUIDs(assetID);
Dump(ids);
foreach (KeyValuePair<UUID, bool> 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 else
m_log.Warn("[HGScene]: Could not post asset to remote asset server " + userAssetURL); m_log.Debug("[HGScene]: Something wrong with asset");
//if (!m_assetMap.ContainsKey(itemID))
// m_assetMap.Add(itemID, asscli);
} }
else else
m_log.Warn("[HGScene]: Unable to locate foreign user's asset server"); m_log.Warn("[HGScene]: Unable to locate foreign user's asset server");