From 1e0ed50d29ac89e8f2d41872967a30b7963cf0ba Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 23 Jan 2017 01:18:27 +0000 Subject: Activate the new Offline IM module code instead of the old code As most have gone to OfflineMessaging V2, this change will not affect existing users but will benefit future grids. --- .../Avatar/InstantMessage/OfflineMessageModule.cs | 24 ++++------------------ 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index d1f6054..297346a 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -248,22 +248,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if (scene == null) scene = m_SceneList[0]; -// Avination new code -// SendReply reply = SynchronousRestObjectRequester.MakeRequest( -// "POST", m_RestURL+"/SaveMessage/?scope=" + -// scene.RegionInfo.ScopeID.ToString(), im); - -// current opensim and osgrid compatible - bool success = SynchronousRestObjectRequester.MakeRequest( - "POST", m_RestURL+"/SaveMessage/", im, 10000); -// current opensim and osgrid compatible end + SendReply reply = SynchronousRestObjectRequester.MakeRequest( + "POST", m_RestURL+"/SaveMessage/?scope=" + + scene.RegionInfo.ScopeID.ToString(), im); if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) { IClientAPI client = FindClient(new UUID(im.fromAgentID)); if (client == null) return; -/* Avination new code + if (reply.Message == String.Empty) reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved"); @@ -296,16 +290,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage reply.Message, false, new Vector3())); } -*/ -// current opensim and osgrid compatible - client.SendInstantMessage(new GridInstantMessage( - null, new UUID(im.toAgentID), - "System", new UUID(im.fromAgentID), - (byte)InstantMessageDialog.MessageFromAgent, - "User is not logged in. "+ - (success ? "Message saved." : "Message not saved"), - false, new Vector3())); -// current opensim and osgrid compatible end } } } -- cgit v1.1 From f50d59843483a9f8ea7e5adff0e454640ac091ec Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 23 Jan 2017 14:06:38 +0000 Subject: Disable spam in profiles module. Modules should not say they're disabled. --- OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index bc8aeca..89e3020 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if (profileConfig == null) { - m_log.Debug("[PROFILES]: UserProfiles disabled, no configuration"); + //m_log.Debug("[PROFILES]: UserProfiles disabled, no configuration"); Enabled = false; return; } -- cgit v1.1 From f0700f48d8280e46f2322f0471b89df41198e93a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 23 Jan 2017 14:26:14 +0000 Subject: Comment some more debug and squelch another module not running msg. Modules whould not require that their .ini key is present. If the user chooses to not use that module, they should not be required to retain the config key for it. --- .../UserProfiles/LocalUserProfilesServiceConnector.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs index 9e75ee2..2e6f472 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs @@ -85,12 +85,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile public LocalUserProfilesServicesConnector() { - m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector no params"); + //m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector no params"); } public LocalUserProfilesServicesConnector(IConfigSource source) { - m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector instantiated directly."); + //m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector instantiated directly."); InitialiseService(source); } @@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile IConfig config = source.Configs[ConfigName]; if (config == null) { - m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: UserProfilesService missing from OpenSim.ini"); + //m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: UserProfilesService missing from OpenSim.ini"); return; } @@ -225,4 +225,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile } #endregion } -} \ No newline at end of file +} -- cgit v1.1 From 32c1127809a27f6400d1585513a70900dac6de78 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 26 Jan 2017 18:35:53 +0000 Subject: Make it possible to override the URL module --- .../CoreModules/Scripting/LSLHttp/UrlModule.cs | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index bb80a88..311deab 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -83,17 +83,17 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private Dictionary m_RequestMap = + protected Dictionary m_RequestMap = new Dictionary(); - private Dictionary m_UrlMap = + protected Dictionary m_UrlMap = new Dictionary(); - private uint m_HttpsPort = 0; - private IHttpServer m_HttpServer = null; - private IHttpServer m_HttpsServer = null; + protected uint m_HttpsPort = 0; + protected IHttpServer m_HttpServer = null; + protected IHttpServer m_HttpsServer = null; - public string ExternalHostNameForLSL { get; private set; } + public string ExternalHostNameForLSL { get; protected set; } /// /// The default maximum number of urls @@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp public Type ReplaceableInterface { - get { return null; } + get { return typeof(IUrlModule); } } public string Name @@ -453,7 +453,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp } - private void RemoveUrl(UrlData data) + protected void RemoveUrl(UrlData data) { if (data.isSsl) m_HttpsServer.RemoveHTTPHandler("", "/lslhttps/"+data.urlcode.ToString()+"/"); @@ -461,7 +461,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp m_HttpServer.RemoveHTTPHandler("", "/lslhttp/"+data.urlcode.ToString()+"/"); } - private Hashtable NoEvents(UUID requestID, UUID sessionID) + protected Hashtable NoEvents(UUID requestID, UUID sessionID) { Hashtable response = new Hashtable(); UrlData url; @@ -499,7 +499,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp return response; } - private bool HasEvents(UUID requestID, UUID sessionID) + protected bool HasEvents(UUID requestID, UUID sessionID) { UrlData url=null; @@ -530,7 +530,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp } } } - private Hashtable GetEvents(UUID requestID, UUID sessionID) + protected Hashtable GetEvents(UUID requestID, UUID sessionID) { UrlData url = null; RequestData requestData = null; @@ -735,7 +735,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp } } - private void OnScriptReset(uint localID, UUID itemID) + protected void OnScriptReset(uint localID, UUID itemID) { ScriptRemoved(itemID); } -- cgit v1.1 From a17db1b3cdae29f1d8681747cd96b1bada185f6c Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 30 Jan 2017 12:58:15 +0000 Subject: Comment two very spammy debug messages that the usr can't do anything about Make a third one conditional. --- OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs | 3 ++- OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs index 52fa908..3d2de82 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs @@ -329,7 +329,8 @@ namespace OpenSim.Region.OptionalModules.Materials AssetBase matAsset = m_scene.AssetService.Get(id.ToString()); if (matAsset == null || matAsset.Data == null || matAsset.Data.Length == 0 ) { - m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id); + if (id != UUID.Zero) + m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id); return; } diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs index 163f439..0117800 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs @@ -454,7 +454,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing if (physicsParms == null) { - m_log.WarnFormat("[MESH]: unknown mesh type for prim {0}",primName); + //m_log.WarnFormat("[MESH]: unknown mesh type for prim {0}",primName); return false; } @@ -712,7 +712,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing else { // if neither mesh or decomposition present, warn and use convex - m_log.WarnFormat("[MESH]: Data for PRIM shape type ( mesh or decomposition) not found for prim {0}",primName); + //m_log.WarnFormat("[MESH]: Data for PRIM shape type ( mesh or decomposition) not found for prim {0}",primName); } } vs.Clear(); -- cgit v1.1 From 5a18ea31cf9d9a97fc1a65f8623b633c244221c2 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 30 Jan 2017 13:59:05 +0000 Subject: Make negative asset caching actually work Also fixes some merge artefacts in HGAssetBroker where cached assets were requested but not actually used and completely squelch a materials debug message because there is nothing the user can do to fix it anyway. --- OpenSim/Framework/IAssetCache.cs | 2 +- OpenSim/Framework/WearableCacheItem.cs | 3 +- .../Agent/TextureSender/J2KDecoderModule.cs | 3 +- .../Region/CoreModules/Asset/CenomeAssetCache.cs | 4 ++- OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs | 6 ++-- .../Region/CoreModules/Asset/FlotsamAssetCache.cs | 37 +++++++++++++++------- .../CoreModules/Asset/GlynnTuckerAssetCache.cs | 4 ++- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 3 +- .../ServiceConnectorsOut/Asset/HGAssetBroker.cs | 34 +++++++++++++++----- .../Asset/LocalAssetServiceConnector.cs | 36 +++++++++++++++++---- .../OptionalModules/Materials/MaterialsModule.cs | 3 +- .../Connectors/Asset/AssetServicesConnector.cs | 37 ++++++++++++++++++---- .../SimianGrid/SimianAssetServiceConnector.cs | 20 +++++++++--- 13 files changed, 147 insertions(+), 45 deletions(-) diff --git a/OpenSim/Framework/IAssetCache.cs b/OpenSim/Framework/IAssetCache.cs index 8477116..1e6d19d 100644 --- a/OpenSim/Framework/IAssetCache.cs +++ b/OpenSim/Framework/IAssetCache.cs @@ -48,7 +48,7 @@ namespace OpenSim.Framework /// /// /// null if the asset does not exist. - AssetBase Get(string id); + AssetBase Get(string id, out bool negative); /// /// Check whether an asset with the specified id exists in the cache. diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs index ccaf69e..f181c39 100644 --- a/OpenSim/Framework/WearableCacheItem.cs +++ b/OpenSim/Framework/WearableCacheItem.cs @@ -113,7 +113,8 @@ namespace OpenSim.Framework { if (dataCache.Check(item.TextureID.ToString())) { - AssetBase assetItem = dataCache.Get(item.TextureID.ToString()); + bool negative; + AssetBase assetItem = dataCache.Get(item.TextureID.ToString(), out negative); if (assetItem != null) { itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data)); diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 2242e42..594b6bb 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -369,7 +369,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender else if (Cache != null) { string assetName = "j2kCache_" + AssetId.ToString(); - AssetBase layerDecodeAsset = Cache.Get(assetName); + bool negative; + AssetBase layerDecodeAsset = Cache.Get(assetName, out negative); if (layerDecodeAsset != null) { diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs index 23c1f03..136134f 100644 --- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs @@ -260,8 +260,10 @@ namespace OpenSim.Region.CoreModules.Asset /// Cache doesn't guarantee in any situation that asset is stored to it. /// /// - public AssetBase Get(string id) + public AssetBase Get(string id, out bool negative) { + negative = false; + m_getCount++; AssetBase assetBase; if (m_cache.TryGetValue(id, out assetBase)) diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs index 51fc3d1..d655509 100644 --- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs @@ -115,7 +115,8 @@ namespace OpenSim.Region.CoreModules.Asset public bool Check(string id) { // XXX This is probably not an efficient implementation. - return Get(id) != null; + bool negative; + return Get(id, out negative) != null; } public void Cache(AssetBase asset) @@ -129,8 +130,9 @@ namespace OpenSim.Region.CoreModules.Asset // We don't do negative caching } - public AssetBase Get(string id) + public AssetBase Get(string id, out bool negative) { + negative = false; return (AssetBase)m_Cache.Get(id); } diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 187f090..b183a75 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -474,6 +474,8 @@ namespace OpenSim.Region.CoreModules.Asset { using (FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) { + if (stream.Length == 0) // Empty file will trigger exception below + return null; BinaryFormatter bformatter = new BinaryFormatter(); asset = (AssetBase)bformatter.Deserialize(stream); @@ -531,13 +533,25 @@ namespace OpenSim.Region.CoreModules.Asset return found; } + // For IAssetService public AssetBase Get(string id) { + bool negative; + return Get(id, out negative); + } + + public AssetBase Get(string id, out bool negative) + { + negative = false; + m_Requests++; object dummy; if (m_negativeCache.TryGetValue(id, out dummy)) + { + negative = true; return null; + } AssetBase asset = null; asset = GetFromWeakReference(id); @@ -578,12 +592,6 @@ namespace OpenSim.Region.CoreModules.Asset GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l)); } - if(asset == null) - { - - - } - return asset; } @@ -599,7 +607,8 @@ namespace OpenSim.Region.CoreModules.Asset public AssetBase GetCached(string id) { - return Get(id); + bool negative; + return Get(id, out negative); } public void Expire(string id) @@ -1227,19 +1236,24 @@ namespace OpenSim.Region.CoreModules.Asset public AssetMetadata GetMetadata(string id) { - AssetBase asset = Get(id); + bool negative; + AssetBase asset = Get(id, out negative); return asset.Metadata; } public byte[] GetData(string id) { - AssetBase asset = Get(id); + bool negative; + AssetBase asset = Get(id, out negative); return asset.Data; } public bool Get(string id, object sender, AssetRetrieved handler) { - AssetBase asset = Get(id); + bool negative; + AssetBase asset = Get(id, out negative); + if (negative) + return false; handler(id, sender, asset); return true; } @@ -1270,7 +1284,8 @@ namespace OpenSim.Region.CoreModules.Asset public bool UpdateContent(string id, byte[] data) { - AssetBase asset = Get(id); + bool negative; + AssetBase asset = Get(id, out negative); asset.Data = data; Cache(asset); return true; diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs index 208963d..342d4d9 100644 --- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs @@ -131,8 +131,10 @@ namespace OpenSim.Region.CoreModules.Asset // We don't do negative caching } - public AssetBase Get(string id) + public AssetBase Get(string id, out bool negative) { + negative = false; + Object asset = null; m_Cache.TryGet(id, out asset); diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index fb408a4..3e47782 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -299,7 +299,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (bakedTextureFace == null) continue; - AssetBase asset = cache.Get(bakedTextureFace.TextureID.ToString()); + bool negative; + AssetBase asset = cache.Get(bakedTextureFace.TextureID.ToString(), out negative); if (asset != null && asset.Local) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index f5aa971..ce61ff0 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs @@ -209,7 +209,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (m_Cache != null) { - asset = m_Cache.Get(id); + bool negative; + asset = m_Cache.Get(id, out negative); + + if (negative) + return null; if (asset != null) return asset; @@ -238,8 +242,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset public AssetBase GetCached(string id) { + bool negative; if (m_Cache != null) - return m_Cache.Get(id); + return m_Cache.Get(id, out negative); return null; } @@ -250,8 +255,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (m_Cache != null) { - if (m_Cache != null) - m_Cache.Get(id); + bool negative; + asset = m_Cache.Get(id, out negative); + + if (negative) + return null; if (asset != null) return asset.Metadata; @@ -273,8 +281,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (m_Cache != null) { - if (m_Cache != null) - m_Cache.Get(id); + bool negative; + asset = m_Cache.Get(id, out negative); + + if (negative) + return null; if (asset != null) return asset.Data; @@ -292,7 +303,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset AssetBase asset = null; if (m_Cache != null) - asset = m_Cache.Get(id); + { + bool negative; + asset = m_Cache.Get(id, out negative); + + if (negative) + return false; + } if (asset != null) { @@ -381,8 +398,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset { AssetBase asset = null; + bool negative; if (m_Cache != null) - asset = m_Cache.Get(id); + asset = m_Cache.Get(id, out negative); if (asset != null) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 7190aa0..bbaed21 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs @@ -158,7 +158,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset AssetBase asset = null; if (m_Cache != null) - asset = m_Cache.Get(id); + { + bool negative; + asset = m_Cache.Get(id, out negative); + + if (negative) + return null; + } if (asset == null) { @@ -178,7 +184,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id); if (m_Cache != null) - return m_Cache.Get(id); + { + bool negative; + return m_Cache.Get(id, out negative); + } return null; } @@ -187,7 +196,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset { AssetBase asset = null; if (m_Cache != null) - asset = m_Cache.Get(id); + { + bool negative; + asset = m_Cache.Get(id, out negative); + if (negative) + return null; + } if (asset != null) return asset.Metadata; @@ -210,7 +224,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset AssetBase asset = null; if (m_Cache != null) - asset = m_Cache.Get(id); + { + bool negative; + asset = m_Cache.Get(id, out negative); + if (negative) + return null; + } if (asset != null) return asset.Data; @@ -232,7 +251,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (m_Cache != null) { - AssetBase asset = m_Cache.Get(id); + bool negative; + AssetBase asset = m_Cache.Get(id, out negative); + + if (negative) + return false; if (asset != null) { @@ -286,8 +309,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset public bool UpdateContent(string id, byte[] data) { AssetBase asset = null; + bool negative; if (m_Cache != null) - m_Cache.Get(id); + m_Cache.Get(id, out negative); if (asset != null) { asset.Data = data; diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs index 3d2de82..e8cb052 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs @@ -329,8 +329,7 @@ namespace OpenSim.Region.OptionalModules.Materials AssetBase matAsset = m_scene.AssetService.Get(id.ToString()); if (matAsset == null || matAsset.Data == null || matAsset.Data.Length == 0 ) { - if (id != UUID.Zero) - m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id); + //m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id); return; } diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 3fa8b54..9595e7b 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -243,8 +243,16 @@ namespace OpenSim.Services.Connectors string uri = MapServer(id) + "/assets/" + id; AssetBase asset = null; + if (m_Cache != null) - asset = m_Cache.Get(id); + { + bool negative; + + asset = m_Cache.Get(id, out negative); + + if (negative) + return null; + } if (asset == null || asset.Data == null || asset.Data.Length == 0) { @@ -275,8 +283,9 @@ namespace OpenSim.Services.Connectors { // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id); + bool negative; if (m_Cache != null) - return m_Cache.Get(id); + return m_Cache.Get(id, out negative); return null; } @@ -285,7 +294,11 @@ namespace OpenSim.Services.Connectors { if (m_Cache != null) { - AssetBase fullAsset = m_Cache.Get(id); + bool negative; + AssetBase fullAsset = m_Cache.Get(id, out negative); + + if (negative) + return null; if (fullAsset != null) return fullAsset.Metadata; @@ -301,7 +314,11 @@ namespace OpenSim.Services.Connectors { if (m_Cache != null) { - AssetBase fullAsset = m_Cache.Get(id); + bool negative; + AssetBase fullAsset = m_Cache.Get(id, out negative); + + if (negative) + return null; if (fullAsset != null) return fullAsset.Data; @@ -389,7 +406,14 @@ namespace OpenSim.Services.Connectors AssetBase asset = null; if (m_Cache != null) - asset = m_Cache.Get(id); + { + bool negative; + + asset = m_Cache.Get(id, out negative); + + if (negative) + return false; + } if (asset == null || asset.Data == null || asset.Data.Length == 0) { @@ -589,8 +613,9 @@ namespace OpenSim.Services.Connectors { AssetBase asset = null; + bool negative; if (m_Cache != null) - asset = m_Cache.Get(id); + asset = m_Cache.Get(id, out negative); if (asset == null) { diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 121e863..af5f69a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -136,7 +136,10 @@ namespace OpenSim.Services.Connectors.SimianGrid // Cache fetch if (m_cache != null) { - AssetBase asset = m_cache.Get(id); + bool negative; + AssetBase asset = m_cache.Get(id, out negative); + if (negative) + return null; if (asset != null) return asset; } @@ -147,8 +150,9 @@ namespace OpenSim.Services.Connectors.SimianGrid public AssetBase GetCached(string id) { + bool negative; if (m_cache != null) - return m_cache.Get(id); + return m_cache.Get(id, out negative); return null; } @@ -169,7 +173,10 @@ namespace OpenSim.Services.Connectors.SimianGrid // Cache fetch if (m_cache != null) { - AssetBase asset = m_cache.Get(id); + bool negative; + AssetBase asset = m_cache.Get(id, out negative); + if (negative) + return null; if (asset != null) return asset.Metadata; } @@ -212,7 +219,12 @@ namespace OpenSim.Services.Connectors.SimianGrid // Cache fetch if (m_cache != null) { - AssetBase asset = m_cache.Get(id); + bool negative; + AssetBase asset = m_cache.Get(id, out negative); + + if (negative) + return false; + if (asset != null) { handler(id, sender, asset); -- cgit v1.1 From 5ceb315e3463eaa50abf43a4c07cb37d9486b1fd Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 1 Feb 2017 15:30:17 +0000 Subject: Secure sim stats with an (optional) password. There is way too much in these stats to expose them to the world, at least for some of us. --- OpenSim/Framework/Monitoring/StatsManager.cs | 13 +++++++++++++ OpenSim/Region/Application/OpenSim.cs | 1 + OpenSim/Region/Application/OpenSimBase.cs | 2 ++ 3 files changed, 16 insertions(+) diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 55c3276..a6b341f 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs @@ -47,6 +47,8 @@ namespace OpenSim.Framework.Monitoring // Subcommand used to list other stats. public const string ListSubCommand = "list"; + public static string StatsPassword { get; set; } + // All subcommands public static HashSet SubCommands = new HashSet { AllSubCommand, ListSubCommand }; @@ -302,6 +304,17 @@ namespace OpenSim.Framework.Monitoring int response_code = 200; string contenttype = "text/json"; + if (StatsPassword != String.Empty && (!request.ContainsKey("pass") || request["pass"].ToString() != StatsPassword)) + { + responsedata["int_response_code"] = response_code; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "Access denied"; + responsedata["access_control_allow_origin"] = "*"; + + return responsedata; + } + string pCategoryName = StatsManager.AllSubCommand; string pContainerName = StatsManager.AllSubCommand; string pStatName = StatsManager.AllSubCommand; diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 8022b1e..58178bc 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -211,6 +211,7 @@ namespace OpenSim if (managedStatsURI != String.Empty) { string urlBase = String.Format("/{0}/", managedStatsURI); + StatsManager.StatsPassword = managedStatsPassword; MainServer.Instance.AddHTTPHandler(urlBase, StatsManager.HandleStatsRequest); m_log.InfoFormat("[OPENSIM] Enabling remote managed stats fetch. URL = {0}", urlBase); } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index b33e2c2..34a9246 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -88,6 +88,7 @@ namespace OpenSim public string userStatsURI = String.Empty; public string managedStatsURI = String.Empty; + public string managedStatsPassword = String.Empty; protected bool m_autoCreateClientStack = true; @@ -239,6 +240,7 @@ namespace OpenSim m_permsModules = new List(permissionModules.Split(',')); managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty); + managedStatsPassword = startupConfig.GetString("ManagedStatsRemoteFetchPassword", String.Empty); } // Load the simulation data service -- cgit v1.1 From a5151bb337cfee14dff6045d7f8e293201ae94ac Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 1 Feb 2017 16:31:01 +0000 Subject: Refactor asset handling as per Ubit's suggestion --- OpenSim/Framework/IAssetCache.cs | 5 +-- OpenSim/Framework/WearableCacheItem.cs | 4 +-- .../Agent/TextureSender/J2KDecoderModule.cs | 4 +-- .../Region/CoreModules/Asset/CenomeAssetCache.cs | 7 ++-- OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs | 12 ++++--- .../Region/CoreModules/Asset/FlotsamAssetCache.cs | 38 +++++++++++----------- .../CoreModules/Asset/GlynnTuckerAssetCache.cs | 13 ++++---- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 4 +-- .../ServiceConnectorsOut/Asset/HGAssetBroker.cs | 27 ++++----------- .../Asset/LocalAssetServiceConnector.cs | 17 +++------- .../Connectors/Asset/AssetServicesConnector.cs | 35 +++++++------------- .../SimianGrid/SimianAssetServiceConnector.cs | 20 +++++------- 12 files changed, 75 insertions(+), 111 deletions(-) diff --git a/OpenSim/Framework/IAssetCache.cs b/OpenSim/Framework/IAssetCache.cs index 1e6d19d..2df9199 100644 --- a/OpenSim/Framework/IAssetCache.cs +++ b/OpenSim/Framework/IAssetCache.cs @@ -47,8 +47,9 @@ namespace OpenSim.Framework /// Get an asset by its id. /// /// - /// null if the asset does not exist. - AssetBase Get(string id, out bool negative); + /// Will be set to null if no asset was found + /// False if the asset has been negative-cached + bool Get(string id, out AssetBase asset); /// /// Check whether an asset with the specified id exists in the cache. diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs index f181c39..427e149 100644 --- a/OpenSim/Framework/WearableCacheItem.cs +++ b/OpenSim/Framework/WearableCacheItem.cs @@ -113,8 +113,8 @@ namespace OpenSim.Framework { if (dataCache.Check(item.TextureID.ToString())) { - bool negative; - AssetBase assetItem = dataCache.Get(item.TextureID.ToString(), out negative); + AssetBase assetItem; + dataCache.Get(item.TextureID.ToString(), out assetItem); if (assetItem != null) { itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data)); diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 594b6bb..6e4a710 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -369,8 +369,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender else if (Cache != null) { string assetName = "j2kCache_" + AssetId.ToString(); - bool negative; - AssetBase layerDecodeAsset = Cache.Get(assetName, out negative); + AssetBase layerDecodeAsset; + Cache.Get(assetName, out layerDecodeAsset); if (layerDecodeAsset != null) { diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs index 136134f..403236c 100644 --- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs @@ -260,12 +260,9 @@ namespace OpenSim.Region.CoreModules.Asset /// Cache doesn't guarantee in any situation that asset is stored to it. /// /// - public AssetBase Get(string id, out bool negative) + public bool Get(string id, out AssetBase assetBase) { - negative = false; - m_getCount++; - AssetBase assetBase; if (m_cache.TryGetValue(id, out assetBase)) m_hitCount++; @@ -286,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Asset // if (null == assetBase) // m_log.DebugFormat("[CENOME ASSET CACHE]: Asset {0} not in cache", id); - return assetBase; + return true; } #endregion diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs index d655509..10c0e85 100644 --- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs @@ -115,8 +115,10 @@ namespace OpenSim.Region.CoreModules.Asset public bool Check(string id) { // XXX This is probably not an efficient implementation. - bool negative; - return Get(id, out negative) != null; + AssetBase asset; + if (!Get(id, out asset)) + return false; + return asset != null; } public void Cache(AssetBase asset) @@ -130,10 +132,10 @@ namespace OpenSim.Region.CoreModules.Asset // We don't do negative caching } - public AssetBase Get(string id, out bool negative) + public bool Get(string id, out AssetBase asset) { - negative = false; - return (AssetBase)m_Cache.Get(id); + asset = (AssetBase)m_Cache.Get(id); + return true; } public void Expire(string id) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index b183a75..f8a4461 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -536,24 +536,23 @@ namespace OpenSim.Region.CoreModules.Asset // For IAssetService public AssetBase Get(string id) { - bool negative; - return Get(id, out negative); + AssetBase asset; + Get(id, out asset); + return asset; } - public AssetBase Get(string id, out bool negative) + public bool Get(string id, out AssetBase asset) { - negative = false; + asset = null; m_Requests++; object dummy; if (m_negativeCache.TryGetValue(id, out dummy)) { - negative = true; - return null; + return false; } - AssetBase asset = null; asset = GetFromWeakReference(id); if (asset != null && m_updateFileTimeOnCacheHit) { @@ -592,7 +591,7 @@ namespace OpenSim.Region.CoreModules.Asset GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l)); } - return asset; + return true; } public bool Check(string id) @@ -607,8 +606,9 @@ namespace OpenSim.Region.CoreModules.Asset public AssetBase GetCached(string id) { - bool negative; - return Get(id, out negative); + AssetBase asset; + Get(id, out asset); + return asset; } public void Expire(string id) @@ -1236,23 +1236,22 @@ namespace OpenSim.Region.CoreModules.Asset public AssetMetadata GetMetadata(string id) { - bool negative; - AssetBase asset = Get(id, out negative); + AssetBase asset; + Get(id, out asset); return asset.Metadata; } public byte[] GetData(string id) { - bool negative; - AssetBase asset = Get(id, out negative); + AssetBase asset; + Get(id, out asset); return asset.Data; } public bool Get(string id, object sender, AssetRetrieved handler) { - bool negative; - AssetBase asset = Get(id, out negative); - if (negative) + AssetBase asset; + if (!Get(id, out asset)) return false; handler(id, sender, asset); return true; @@ -1284,8 +1283,9 @@ namespace OpenSim.Region.CoreModules.Asset public bool UpdateContent(string id, byte[] data) { - bool negative; - AssetBase asset = Get(id, out negative); + AssetBase asset; + if (!Get(id, out asset)) + return false; asset.Data = data; Cache(asset); return true; diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs index 342d4d9..abe9b23 100644 --- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs @@ -131,16 +131,15 @@ namespace OpenSim.Region.CoreModules.Asset // We don't do negative caching } - public AssetBase Get(string id, out bool negative) + public bool Get(string id, out AssetBase asset) { - negative = false; + Object a = null; + m_Cache.TryGet(id, out a); - Object asset = null; - m_Cache.TryGet(id, out asset); - - Debug(asset); + Debug(a); - return (AssetBase)asset; + asset = (AssetBase)a; + return true; } public void Expire(string id) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 3e47782..535d946 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -299,8 +299,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (bakedTextureFace == null) continue; - bool negative; - AssetBase asset = cache.Get(bakedTextureFace.TextureID.ToString(), out negative); + AssetBase asset; + cache.Get(bakedTextureFace.TextureID.ToString(), out asset); if (asset != null && asset.Local) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index ce61ff0..bf9327c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs @@ -209,10 +209,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (m_Cache != null) { - bool negative; - asset = m_Cache.Get(id, out negative); - - if (negative) + if (!m_Cache.Get(id, out asset)) return null; if (asset != null) @@ -242,9 +239,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset public AssetBase GetCached(string id) { - bool negative; + AssetBase asset = null; if (m_Cache != null) - return m_Cache.Get(id, out negative); + m_Cache.Get(id, out asset); return null; } @@ -255,10 +252,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (m_Cache != null) { - bool negative; - asset = m_Cache.Get(id, out negative); - - if (negative) + if (!m_Cache.Get(id, out asset)) return null; if (asset != null) @@ -281,10 +275,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (m_Cache != null) { - bool negative; - asset = m_Cache.Get(id, out negative); - - if (negative) + if (!m_Cache.Get(id, out asset)) return null; if (asset != null) @@ -304,10 +295,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (m_Cache != null) { - bool negative; - asset = m_Cache.Get(id, out negative); - - if (negative) + if (!m_Cache.Get(id, out asset)) return false; } @@ -398,9 +386,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset { AssetBase asset = null; - bool negative; if (m_Cache != null) - asset = m_Cache.Get(id, out negative); + m_Cache.Get(id, out asset); if (asset != null) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index bbaed21..2fe9733 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs @@ -159,10 +159,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset AssetBase asset = null; if (m_Cache != null) { - bool negative; - asset = m_Cache.Get(id, out negative); - - if (negative) + if (!m_Cache.Get(id, out asset)) return null; } @@ -183,13 +180,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset { // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id); + AssetBase asset = null; if (m_Cache != null) - { - bool negative; - return m_Cache.Get(id, out negative); - } + m_Cache.Get(id, out asset); - return null; + return asset; } public AssetMetadata GetMetadata(string id) @@ -197,9 +192,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset AssetBase asset = null; if (m_Cache != null) { - bool negative; - asset = m_Cache.Get(id, out negative); - if (negative) + if (!m_Cache.Get(id, out asset)) return null; } diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 9595e7b..810da2f 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -246,11 +246,7 @@ namespace OpenSim.Services.Connectors if (m_Cache != null) { - bool negative; - - asset = m_Cache.Get(id, out negative); - - if (negative) + if (!m_Cache.Get(id, out asset)) return null; } @@ -283,21 +279,21 @@ namespace OpenSim.Services.Connectors { // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id); - bool negative; + AssetBase asset = null; if (m_Cache != null) - return m_Cache.Get(id, out negative); + { + m_Cache.Get(id, out asset); + } - return null; + return asset; } public AssetMetadata GetMetadata(string id) { if (m_Cache != null) { - bool negative; - AssetBase fullAsset = m_Cache.Get(id, out negative); - - if (negative) + AssetBase fullAsset; + if (!m_Cache.Get(id, out fullAsset)) return null; if (fullAsset != null) @@ -314,10 +310,8 @@ namespace OpenSim.Services.Connectors { if (m_Cache != null) { - bool negative; - AssetBase fullAsset = m_Cache.Get(id, out negative); - - if (negative) + AssetBase fullAsset; + if (!m_Cache.Get(id, out fullAsset)) return null; if (fullAsset != null) @@ -407,11 +401,7 @@ namespace OpenSim.Services.Connectors AssetBase asset = null; if (m_Cache != null) { - bool negative; - - asset = m_Cache.Get(id, out negative); - - if (negative) + if (!m_Cache.Get(id, out asset)) return false; } @@ -613,9 +603,8 @@ namespace OpenSim.Services.Connectors { AssetBase asset = null; - bool negative; if (m_Cache != null) - asset = m_Cache.Get(id, out negative); + m_Cache.Get(id, out asset); if (asset == null) { diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index af5f69a..953bc2a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -136,9 +136,8 @@ namespace OpenSim.Services.Connectors.SimianGrid // Cache fetch if (m_cache != null) { - bool negative; - AssetBase asset = m_cache.Get(id, out negative); - if (negative) + AssetBase asset; + if (!m_cache.Get(id, out asset)) return null; if (asset != null) return asset; @@ -150,9 +149,9 @@ namespace OpenSim.Services.Connectors.SimianGrid public AssetBase GetCached(string id) { - bool negative; + AssetBase asset; if (m_cache != null) - return m_cache.Get(id, out negative); + m_cache.Get(id, out asset); return null; } @@ -173,9 +172,8 @@ namespace OpenSim.Services.Connectors.SimianGrid // Cache fetch if (m_cache != null) { - bool negative; - AssetBase asset = m_cache.Get(id, out negative); - if (negative) + AssetBase asset; + if (!m_cache.Get(id, out asset)) return null; if (asset != null) return asset.Metadata; @@ -219,10 +217,8 @@ namespace OpenSim.Services.Connectors.SimianGrid // Cache fetch if (m_cache != null) { - bool negative; - AssetBase asset = m_cache.Get(id, out negative); - - if (negative) + AssetBase asset; + if (!m_cache.Get(id, out asset)) return false; if (asset != null) -- cgit v1.1 From 60cf3f759fbadb3405ac7e266ddd13106ae3cbb2 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 1 Feb 2017 16:34:07 +0000 Subject: Refactor part II --- .../Asset/LocalAssetServiceConnector.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 2fe9733..37a48bb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs @@ -218,9 +218,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (m_Cache != null) { - bool negative; - asset = m_Cache.Get(id, out negative); - if (negative) + if (!m_Cache.Get(id, out asset)) return null; } @@ -244,10 +242,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (m_Cache != null) { - bool negative; - AssetBase asset = m_Cache.Get(id, out negative); - - if (negative) + AssetBase asset; + if (!m_Cache.Get(id, out asset)) return false; if (asset != null) @@ -302,9 +298,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset public bool UpdateContent(string id, byte[] data) { AssetBase asset = null; - bool negative; if (m_Cache != null) - m_Cache.Get(id, out negative); + m_Cache.Get(id, out asset); if (asset != null) { asset.Data = data; -- cgit v1.1