Hypergrid: don't send Local assets to other grids

This commit also contains other changes, but they're all just for clarity. The only actual behavior change is to avoid Posting local assets.
0.8.0.3
Oren Hurvitz 2014-04-23 08:44:00 +03:00
parent 2506b3d89e
commit 7eb12f96ec
1 changed files with 35 additions and 36 deletions

View File

@ -118,15 +118,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (string.IsNullOrEmpty(url)) if (string.IsNullOrEmpty(url))
return false; return false;
if (asset != null)
{
if (!url.EndsWith("/") && !url.EndsWith("=")) if (!url.EndsWith("/") && !url.EndsWith("="))
url = url + "/"; url = url + "/";
bool success = true; if (asset == null)
// See long comment in AssetCache.AddAsset
if (!asset.Temporary || asset.Local)
{ {
m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache.");
return false;
}
// See long comment in AssetCache.AddAsset
if (asset.Temporary || asset.Local)
return true;
// We need to copy the asset into a new asset, because // We need to copy the asset into a new asset, because
// we need to set its ID to be URL+UUID, so that the // we need to set its ID to be URL+UUID, so that the
// HGAssetService dispatches it to the remote grid. // HGAssetService dispatches it to the remote grid.
@ -145,19 +149,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
string id = m_scene.AssetService.Store(asset1); string id = m_scene.AssetService.Store(asset1);
if (String.IsNullOrEmpty(id)) if (String.IsNullOrEmpty(id))
{ {
m_log.DebugFormat("[HG ASSET MAPPER]: Failed to post asset {0} to asset server {1}: the server did not accept the asset", asset.ID, url); m_log.DebugFormat("[HG ASSET MAPPER]: Asset server {0} did not accept {1}", url, asset.ID);
success = false;
}
else
m_log.DebugFormat("[HG ASSET MAPPER]: Posted asset {0} to asset server {1}", asset1.ID, url);
}
return success;
}
else
m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache.");
return false; return false;
} }
else {
m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url);
return true;
}
}
private void Copy(AssetBase from, AssetBase to) private void Copy(AssetBase from, AssetBase to)
{ {