From da170cde4684ea0f8ed90ea4ed0b30172ad9981d Mon Sep 17 00:00:00 2001 From: diva Date: Fri, 22 May 2009 04:23:59 +0000 Subject: Cleaning up a few HG things. HG Posts may now work in grids, but if the home grid is a standalone, this still doesn't work -- something wrong with RegionAssetService's DB connection. --- .../Asset/LocalAssetServiceConnector.cs | 35 +++++++++++++++------- .../Framework/Scenes/Hypergrid/HGAssetMapper.cs | 11 ------- 2 files changed, 24 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs index 4e802ed..3750991 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs @@ -146,7 +146,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset public AssetBase Get(string id) { - AssetBase asset = m_Cache.Get(id); + AssetBase asset = null; + if (m_Cache != null) + asset = m_Cache.Get(id); if (asset == null) return m_AssetService.Get(id); @@ -155,15 +157,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset public AssetMetadata GetMetadata(string id) { - AssetBase asset = m_Cache.Get(id); + AssetBase asset = null; + if (m_Cache != null) + asset = m_Cache.Get(id); if (asset != null) return asset.Metadata; asset = m_AssetService.Get(id); - if (asset != null) + if (asset != null) { - m_Cache.Cache(asset); + if (m_Cache != null) + m_Cache.Cache(asset); return asset.Metadata; } @@ -180,7 +185,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset asset = m_AssetService.Get(id); if (asset != null) { - m_Cache.Cache(asset); + if (m_Cache != null) + m_Cache.Cache(asset); return asset.Data; } @@ -189,7 +195,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset public bool Get(string id, Object sender, AssetRetrieved handler) { - AssetBase asset = m_Cache.Get(id); + AssetBase asset = null; + if (m_Cache != null) + m_Cache.Get(id); if (asset != null) { @@ -199,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) { - if (a != null) + if ((a != null) && (m_Cache != null)) m_Cache.Cache(a); handler(assetID, s, a); }); @@ -207,7 +215,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset public string Store(AssetBase asset) { - m_Cache.Cache(asset); + if (m_Cache != null) + m_Cache.Cache(asset); if (asset.Temporary || asset.Local) return asset.ID; return m_AssetService.Store(asset); @@ -215,11 +224,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset public bool UpdateContent(string id, byte[] data) { - AssetBase asset = m_Cache.Get(id); + AssetBase asset = null; + if (m_Cache != null) + m_Cache.Get(id); if (asset != null) { asset.Data = data; - m_Cache.Cache(asset); + if (m_Cache != null) + m_Cache.Cache(asset); } return m_AssetService.UpdateContent(id, data); @@ -227,7 +239,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset public bool Delete(string id) { - m_Cache.Expire(id); + if (m_Cache != null) + m_Cache.Expire(id); return m_AssetService.Delete(id); } diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs index 1750bbf..720a09b 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs @@ -46,12 +46,6 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid #region Fields private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - // This maps between asset server URLs and asset server clients - private Dictionary m_assetServers = new Dictionary(); - - // This maps between asset UUIDs and asset servers - private Dictionary m_assetMap = new Dictionary(); - // This maps between inventory server urls and inventory server clients private Dictionary m_inventoryServers = new Dictionary(); @@ -103,11 +97,6 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid return false; } - private bool IsInAssetMap(UUID uuid) - { - return m_assetMap.ContainsKey(uuid); - } - private AssetBase FetchAsset(string url, UUID assetID, bool isTexture) { AssetBase asset = m_scene.AssetService.Get(url + "/" + assetID.ToString()); -- cgit v1.1