some more changes; HG standalones broken (at least)

This commit is contained in:
UbitUmarov
2020-10-24 22:31:59 +01:00
parent 7c822d3fbf
commit abe7a31952
7 changed files with 67 additions and 45 deletions

View File

@@ -1891,16 +1891,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
if(string.IsNullOrWhiteSpace(assetServerURI))
return;
string imageIDstr = imageID.ToString();
if(m_assetCache != null && m_assetCache.Check(imageIDstr))
return;
if(Scene.AssetService.Get(imageIDstr) != null)
return;
Scene.AssetService.Get(string.Format("{0}/{1}", assetServerURI, imageIDstr));
Scene.AssetService.Get(imageID.ToString(), assetServerURI);
}
/// <summary>

View File

@@ -98,10 +98,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (string.IsNullOrEmpty(url))
return null;
if (!url.EndsWith("/") && !url.EndsWith("="))
url = url + "/";
asset = m_scene.AssetService.Get(url + assetIDstr);
asset = m_scene.AssetService.Get(assetIDstr, url);
//if (asset != null)
// m_log.DebugFormat("[HG ASSET MAPPER]: Fetched asset {0} of type {1} from {2} ", assetID, asset.Metadata.Type, url);

View File

@@ -153,6 +153,41 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
return asset;
}
public AssetBase Get(string id, string ForeignAssetService)
{
// assumes id and ForeignAssetService are valid and resolved
AssetBase asset = null;
if (m_Cache != null)
{
m_Cache.Get(id, out asset); // negative cache is a fail on HG
}
if (asset == null)
{
asset = GetFromLocal(id);
if (asset == null)
{
asset = GetFromForeign(id, ForeignAssetService);
if (asset != null)
{
if (m_AssetPerms.AllowedImport(asset.Type))
base.Store(asset);
else
{
if (m_Cache != null)
m_Cache.CacheNegative(id);
return null;
}
}
else if (m_Cache != null)
m_Cache.CacheNegative(id);
}
else if (m_Cache != null)
m_Cache.Cache(asset);
}
return asset;
}
public override AssetMetadata GetMetadata(string id)
{
if (IsHG(id))

View File

@@ -151,8 +151,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (asset == null)
{
asset = m_AssetService.Get(id);
if ((m_Cache != null) && (asset != null) && asset.ID != id)
m_Cache.Cache(asset);
if (m_Cache != null)
{
if(asset != null)
m_Cache.Cache(asset);
else
m_Cache.CacheNegative(id);
}
//if (null == asset)
// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not synchronously find asset with id {0}", id);
@@ -243,7 +248,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
}
}
return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a)
return m_AssetService.Get(id, sender, delegate (string assetID, object s, AssetBase a)
{
if ((a != null) && (m_Cache != null))
m_Cache.Cache(a);

View File

@@ -313,11 +313,9 @@ namespace OpenSim.Services.Connectors
return null;
}
if (asset == null || asset.Data == null || asset.Data.Length == 0)
if (asset == null)
{
string uri = MapServer(id) + "/assets/" + id;
asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, m_Auth);
asset = GetFromLocal(id);
if (m_Cache != null)
{
if (asset != null)
@@ -329,28 +327,21 @@ namespace OpenSim.Services.Connectors
return asset;
}
public AssetBase Get(string id, string ForeignAssetService)
public AssetBase GetFromLocal(string id)
{
// assumes id and ForeignAssetService are valid and resolved
AssetBase asset = null;
if (m_Cache != null)
{
m_Cache.Get(id, out asset); // negative cache is a fail on HG
}
string local = MapServer(id) + "/assets/" + id;
return SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", local, 0, m_Auth);
}
if (asset == null)
{
IServiceAuth auth = null;
if (ForeignAssetService.Equals(m_ServerURI))
{
ForeignAssetService = MapServer(id) + "/assets/" + id;
auth = m_Auth;
}
else
ForeignAssetService = ForeignAssetService + "/assets/" + id;
asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", ForeignAssetService, 0, auth);
}
return asset;
public AssetBase GetFromForeign(string id, string ForeignAssetService)
{
if(string.IsNullOrEmpty(ForeignAssetService) || ForeignAssetService.Equals(m_ServerURI))
return null;
if(ForeignAssetService.EndsWith("/"))
ForeignAssetService = ForeignAssetService + "assets/" + id;
else
ForeignAssetService = ForeignAssetService + "/assets/" + id;
return SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", ForeignAssetService, 0, null);
}
public AssetBase GetForeign(string id)
@@ -367,7 +358,7 @@ namespace OpenSim.Services.Connectors
m_Cache.Get(uuidstr, out asset); // negative cache is a fail on HG
}
if (asset == null || asset.Data == null || asset.Data.Length == 0)
if (asset == null)
{
IServiceAuth auth = null;
if (type == 0)

View File

@@ -112,5 +112,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
else
m_log.InfoFormat("[ASSET CONNECTOR]: Enabled remote assets without caching for region {0}", scene.RegionInfo.RegionName);
}
public AssetBase Get(string id, string ForeignAssetService)
{
return Get(id); // no hg
}
}
}

View File

@@ -122,9 +122,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
}
Object[] args = new Object[] { source };
m_GridService =
ServerUtils.LoadPlugin<IGridService>(serviceDll,
args);
m_GridService = ServerUtils.LoadPlugin<IGridService>(serviceDll, args);
if (m_GridService == null)
{