Merge branch 'melanie'

httptests
Melanie Thielker 2017-02-01 16:34:49 +00:00
commit 202fcc7d6f
21 changed files with 158 additions and 96 deletions

View File

@ -47,8 +47,9 @@ namespace OpenSim.Framework
/// Get an asset by its id. /// Get an asset by its id.
/// </summary> /// </summary>
/// <param name='id'></param> /// <param name='id'></param>
/// <returns>null if the asset does not exist.</returns> /// <param name='asset'>Will be set to null if no asset was found</param>
AssetBase Get(string id); /// <returns>False if the asset has been negative-cached</returns>
bool Get(string id, out AssetBase asset);
/// <summary> /// <summary>
/// Check whether an asset with the specified id exists in the cache. /// Check whether an asset with the specified id exists in the cache.

View File

@ -47,6 +47,8 @@ namespace OpenSim.Framework.Monitoring
// Subcommand used to list other stats. // Subcommand used to list other stats.
public const string ListSubCommand = "list"; public const string ListSubCommand = "list";
public static string StatsPassword { get; set; }
// All subcommands // All subcommands
public static HashSet<string> SubCommands = new HashSet<string> { AllSubCommand, ListSubCommand }; public static HashSet<string> SubCommands = new HashSet<string> { AllSubCommand, ListSubCommand };
@ -302,6 +304,17 @@ namespace OpenSim.Framework.Monitoring
int response_code = 200; int response_code = 200;
string contenttype = "text/json"; 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 pCategoryName = StatsManager.AllSubCommand;
string pContainerName = StatsManager.AllSubCommand; string pContainerName = StatsManager.AllSubCommand;
string pStatName = StatsManager.AllSubCommand; string pStatName = StatsManager.AllSubCommand;

View File

@ -113,7 +113,8 @@ namespace OpenSim.Framework
{ {
if (dataCache.Check(item.TextureID.ToString())) if (dataCache.Check(item.TextureID.ToString()))
{ {
AssetBase assetItem = dataCache.Get(item.TextureID.ToString()); AssetBase assetItem;
dataCache.Get(item.TextureID.ToString(), out assetItem);
if (assetItem != null) if (assetItem != null)
{ {
itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data)); itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data));

View File

@ -211,6 +211,7 @@ namespace OpenSim
if (managedStatsURI != String.Empty) if (managedStatsURI != String.Empty)
{ {
string urlBase = String.Format("/{0}/", managedStatsURI); string urlBase = String.Format("/{0}/", managedStatsURI);
StatsManager.StatsPassword = managedStatsPassword;
MainServer.Instance.AddHTTPHandler(urlBase, StatsManager.HandleStatsRequest); MainServer.Instance.AddHTTPHandler(urlBase, StatsManager.HandleStatsRequest);
m_log.InfoFormat("[OPENSIM] Enabling remote managed stats fetch. URL = {0}", urlBase); m_log.InfoFormat("[OPENSIM] Enabling remote managed stats fetch. URL = {0}", urlBase);
} }

View File

@ -88,6 +88,7 @@ namespace OpenSim
public string userStatsURI = String.Empty; public string userStatsURI = String.Empty;
public string managedStatsURI = String.Empty; public string managedStatsURI = String.Empty;
public string managedStatsPassword = String.Empty;
protected bool m_autoCreateClientStack = true; protected bool m_autoCreateClientStack = true;
@ -239,6 +240,7 @@ namespace OpenSim
m_permsModules = new List<string>(permissionModules.Split(',')); m_permsModules = new List<string>(permissionModules.Split(','));
managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty); managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty);
managedStatsPassword = startupConfig.GetString("ManagedStatsRemoteFetchPassword", String.Empty);
} }
// Load the simulation data service // Load the simulation data service

View File

@ -369,7 +369,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
else if (Cache != null) else if (Cache != null)
{ {
string assetName = "j2kCache_" + AssetId.ToString(); string assetName = "j2kCache_" + AssetId.ToString();
AssetBase layerDecodeAsset = Cache.Get(assetName); AssetBase layerDecodeAsset;
Cache.Get(assetName, out layerDecodeAsset);
if (layerDecodeAsset != null) if (layerDecodeAsset != null)
{ {

View File

@ -260,10 +260,9 @@ namespace OpenSim.Region.CoreModules.Asset
/// Cache doesn't guarantee in any situation that asset is stored to it. /// Cache doesn't guarantee in any situation that asset is stored to it.
/// </para> /// </para>
/// </remarks> /// </remarks>
public AssetBase Get(string id) public bool Get(string id, out AssetBase assetBase)
{ {
m_getCount++; m_getCount++;
AssetBase assetBase;
if (m_cache.TryGetValue(id, out assetBase)) if (m_cache.TryGetValue(id, out assetBase))
m_hitCount++; m_hitCount++;
@ -284,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Asset
// if (null == assetBase) // if (null == assetBase)
// m_log.DebugFormat("[CENOME ASSET CACHE]: Asset {0} not in cache", id); // m_log.DebugFormat("[CENOME ASSET CACHE]: Asset {0} not in cache", id);
return assetBase; return true;
} }
#endregion #endregion

View File

@ -115,7 +115,10 @@ namespace OpenSim.Region.CoreModules.Asset
public bool Check(string id) public bool Check(string id)
{ {
// XXX This is probably not an efficient implementation. // XXX This is probably not an efficient implementation.
return Get(id) != null; AssetBase asset;
if (!Get(id, out asset))
return false;
return asset != null;
} }
public void Cache(AssetBase asset) public void Cache(AssetBase asset)
@ -129,9 +132,10 @@ namespace OpenSim.Region.CoreModules.Asset
// We don't do negative caching // We don't do negative caching
} }
public AssetBase Get(string id) public bool Get(string id, out AssetBase asset)
{ {
return (AssetBase)m_Cache.Get(id); asset = (AssetBase)m_Cache.Get(id);
return true;
} }
public void Expire(string id) public void Expire(string id)

View File

@ -474,6 +474,8 @@ namespace OpenSim.Region.CoreModules.Asset
{ {
using (FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) 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(); BinaryFormatter bformatter = new BinaryFormatter();
asset = (AssetBase)bformatter.Deserialize(stream); asset = (AssetBase)bformatter.Deserialize(stream);
@ -531,15 +533,26 @@ namespace OpenSim.Region.CoreModules.Asset
return found; return found;
} }
// For IAssetService
public AssetBase Get(string id) public AssetBase Get(string id)
{ {
AssetBase asset;
Get(id, out asset);
return asset;
}
public bool Get(string id, out AssetBase asset)
{
asset = null;
m_Requests++; m_Requests++;
object dummy; object dummy;
if (m_negativeCache.TryGetValue(id, out dummy)) if (m_negativeCache.TryGetValue(id, out dummy))
return null; {
return false;
}
AssetBase asset = null;
asset = GetFromWeakReference(id); asset = GetFromWeakReference(id);
if (asset != null && m_updateFileTimeOnCacheHit) if (asset != null && m_updateFileTimeOnCacheHit)
{ {
@ -578,13 +591,7 @@ namespace OpenSim.Region.CoreModules.Asset
GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l)); GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l));
} }
if(asset == null) return true;
{
}
return asset;
} }
public bool Check(string id) public bool Check(string id)
@ -599,7 +606,9 @@ namespace OpenSim.Region.CoreModules.Asset
public AssetBase GetCached(string id) public AssetBase GetCached(string id)
{ {
return Get(id); AssetBase asset;
Get(id, out asset);
return asset;
} }
public void Expire(string id) public void Expire(string id)
@ -1227,19 +1236,23 @@ namespace OpenSim.Region.CoreModules.Asset
public AssetMetadata GetMetadata(string id) public AssetMetadata GetMetadata(string id)
{ {
AssetBase asset = Get(id); AssetBase asset;
Get(id, out asset);
return asset.Metadata; return asset.Metadata;
} }
public byte[] GetData(string id) public byte[] GetData(string id)
{ {
AssetBase asset = Get(id); AssetBase asset;
Get(id, out asset);
return asset.Data; return asset.Data;
} }
public bool Get(string id, object sender, AssetRetrieved handler) public bool Get(string id, object sender, AssetRetrieved handler)
{ {
AssetBase asset = Get(id); AssetBase asset;
if (!Get(id, out asset))
return false;
handler(id, sender, asset); handler(id, sender, asset);
return true; return true;
} }
@ -1270,7 +1283,9 @@ namespace OpenSim.Region.CoreModules.Asset
public bool UpdateContent(string id, byte[] data) public bool UpdateContent(string id, byte[] data)
{ {
AssetBase asset = Get(id); AssetBase asset;
if (!Get(id, out asset))
return false;
asset.Data = data; asset.Data = data;
Cache(asset); Cache(asset);
return true; return true;

View File

@ -131,14 +131,15 @@ namespace OpenSim.Region.CoreModules.Asset
// We don't do negative caching // We don't do negative caching
} }
public AssetBase Get(string id) public bool Get(string id, out AssetBase asset)
{ {
Object asset = null; Object a = null;
m_Cache.TryGet(id, out asset); m_Cache.TryGet(id, out a);
Debug(asset); Debug(a);
return (AssetBase)asset; asset = (AssetBase)a;
return true;
} }
public void Expire(string id) public void Expire(string id)

View File

@ -299,7 +299,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
if (bakedTextureFace == null) if (bakedTextureFace == null)
continue; continue;
AssetBase asset = cache.Get(bakedTextureFace.TextureID.ToString()); AssetBase asset;
cache.Get(bakedTextureFace.TextureID.ToString(), out asset);
if (asset != null && asset.Local) if (asset != null && asset.Local)
{ {

View File

@ -248,22 +248,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (scene == null) if (scene == null)
scene = m_SceneList[0]; scene = m_SceneList[0];
// Avination new code SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>(
// SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>( "POST", m_RestURL+"/SaveMessage/?scope=" +
// "POST", m_RestURL+"/SaveMessage/?scope=" + scene.RegionInfo.ScopeID.ToString(), im);
// scene.RegionInfo.ScopeID.ToString(), im);
// current opensim and osgrid compatible
bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
"POST", m_RestURL+"/SaveMessage/", im, 10000);
// current opensim and osgrid compatible end
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
{ {
IClientAPI client = FindClient(new UUID(im.fromAgentID)); IClientAPI client = FindClient(new UUID(im.fromAgentID));
if (client == null) if (client == null)
return; return;
/* Avination new code
if (reply.Message == String.Empty) if (reply.Message == String.Empty)
reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved"); 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, reply.Message,
false, new Vector3())); 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
} }
} }
} }

View File

@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
if (profileConfig == null) if (profileConfig == null)
{ {
m_log.Debug("[PROFILES]: UserProfiles disabled, no configuration"); //m_log.Debug("[PROFILES]: UserProfiles disabled, no configuration");
Enabled = false; Enabled = false;
return; return;
} }

View File

@ -83,17 +83,17 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<UUID, UrlData> m_RequestMap = protected Dictionary<UUID, UrlData> m_RequestMap =
new Dictionary<UUID, UrlData>(); new Dictionary<UUID, UrlData>();
private Dictionary<string, UrlData> m_UrlMap = protected Dictionary<string, UrlData> m_UrlMap =
new Dictionary<string, UrlData>(); new Dictionary<string, UrlData>();
private uint m_HttpsPort = 0; protected uint m_HttpsPort = 0;
private IHttpServer m_HttpServer = null; protected IHttpServer m_HttpServer = null;
private IHttpServer m_HttpsServer = null; protected IHttpServer m_HttpsServer = null;
public string ExternalHostNameForLSL { get; private set; } public string ExternalHostNameForLSL { get; protected set; }
/// <summary> /// <summary>
/// The default maximum number of urls /// The default maximum number of urls
@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
public Type ReplaceableInterface public Type ReplaceableInterface
{ {
get { return null; } get { return typeof(IUrlModule); }
} }
public string Name 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) if (data.isSsl)
m_HttpsServer.RemoveHTTPHandler("", "/lslhttps/"+data.urlcode.ToString()+"/"); m_HttpsServer.RemoveHTTPHandler("", "/lslhttps/"+data.urlcode.ToString()+"/");
@ -461,7 +461,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
m_HttpServer.RemoveHTTPHandler("", "/lslhttp/"+data.urlcode.ToString()+"/"); 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(); Hashtable response = new Hashtable();
UrlData url; UrlData url;
@ -499,7 +499,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
return response; return response;
} }
private bool HasEvents(UUID requestID, UUID sessionID) protected bool HasEvents(UUID requestID, UUID sessionID)
{ {
UrlData url=null; 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; UrlData url = null;
RequestData requestData = 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); ScriptRemoved(itemID);
} }

View File

@ -85,12 +85,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile
public LocalUserProfilesServicesConnector() 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) 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); InitialiseService(source);
} }
@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile
IConfig config = source.Configs[ConfigName]; IConfig config = source.Configs[ConfigName];
if (config == null) 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; return;
} }

View File

@ -209,7 +209,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null) if (m_Cache != null)
{ {
asset = m_Cache.Get(id); if (!m_Cache.Get(id, out asset))
return null;
if (asset != null) if (asset != null)
return asset; return asset;
@ -238,8 +239,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
public AssetBase GetCached(string id) public AssetBase GetCached(string id)
{ {
AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
return m_Cache.Get(id); m_Cache.Get(id, out asset);
return null; return null;
} }
@ -250,8 +252,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null) if (m_Cache != null)
{ {
if (m_Cache != null) if (!m_Cache.Get(id, out asset))
m_Cache.Get(id); return null;
if (asset != null) if (asset != null)
return asset.Metadata; return asset.Metadata;
@ -273,8 +275,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null) if (m_Cache != null)
{ {
if (m_Cache != null) if (!m_Cache.Get(id, out asset))
m_Cache.Get(id); return null;
if (asset != null) if (asset != null)
return asset.Data; return asset.Data;
@ -292,7 +294,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
AssetBase asset = null; AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
asset = m_Cache.Get(id); {
if (!m_Cache.Get(id, out asset))
return false;
}
if (asset != null) if (asset != null)
{ {
@ -382,7 +387,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
AssetBase asset = null; AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
asset = m_Cache.Get(id); m_Cache.Get(id, out asset);
if (asset != null) if (asset != null)
{ {

View File

@ -158,7 +158,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
AssetBase asset = null; AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
asset = m_Cache.Get(id); {
if (!m_Cache.Get(id, out asset))
return null;
}
if (asset == null) if (asset == null)
{ {
@ -177,17 +180,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
{ {
// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id); // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id);
AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
return m_Cache.Get(id); m_Cache.Get(id, out asset);
return null; return asset;
} }
public AssetMetadata GetMetadata(string id) public AssetMetadata GetMetadata(string id)
{ {
AssetBase asset = null; AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
asset = m_Cache.Get(id); {
if (!m_Cache.Get(id, out asset))
return null;
}
if (asset != null) if (asset != null)
return asset.Metadata; return asset.Metadata;
@ -210,7 +217,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
AssetBase asset = null; AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
asset = m_Cache.Get(id); {
if (!m_Cache.Get(id, out asset))
return null;
}
if (asset != null) if (asset != null)
return asset.Data; return asset.Data;
@ -232,7 +242,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null) if (m_Cache != null)
{ {
AssetBase asset = m_Cache.Get(id); AssetBase asset;
if (!m_Cache.Get(id, out asset))
return false;
if (asset != null) if (asset != null)
{ {
@ -287,7 +299,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
{ {
AssetBase asset = null; AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
m_Cache.Get(id); m_Cache.Get(id, out asset);
if (asset != null) if (asset != null)
{ {
asset.Data = data; asset.Data = data;

View File

@ -329,7 +329,7 @@ namespace OpenSim.Region.OptionalModules.Materials
AssetBase matAsset = m_scene.AssetService.Get(id.ToString()); AssetBase matAsset = m_scene.AssetService.Get(id.ToString());
if (matAsset == null || matAsset.Data == null || matAsset.Data.Length == 0 ) 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); //m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id);
return; return;
} }

View File

@ -454,7 +454,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
if (physicsParms == null) 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; return false;
} }
@ -712,7 +712,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
else else
{ {
// if neither mesh or decomposition present, warn and use convex // 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(); vs.Clear();

View File

@ -243,8 +243,12 @@ namespace OpenSim.Services.Connectors
string uri = MapServer(id) + "/assets/" + id; string uri = MapServer(id) + "/assets/" + id;
AssetBase asset = null; AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
asset = m_Cache.Get(id); {
if (!m_Cache.Get(id, out asset))
return null;
}
if (asset == null || asset.Data == null || asset.Data.Length == 0) if (asset == null || asset.Data == null || asset.Data.Length == 0)
{ {
@ -275,17 +279,22 @@ namespace OpenSim.Services.Connectors
{ {
// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id); // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id);
AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
return m_Cache.Get(id); {
m_Cache.Get(id, out asset);
}
return null; return asset;
} }
public AssetMetadata GetMetadata(string id) public AssetMetadata GetMetadata(string id)
{ {
if (m_Cache != null) if (m_Cache != null)
{ {
AssetBase fullAsset = m_Cache.Get(id); AssetBase fullAsset;
if (!m_Cache.Get(id, out fullAsset))
return null;
if (fullAsset != null) if (fullAsset != null)
return fullAsset.Metadata; return fullAsset.Metadata;
@ -301,7 +310,9 @@ namespace OpenSim.Services.Connectors
{ {
if (m_Cache != null) if (m_Cache != null)
{ {
AssetBase fullAsset = m_Cache.Get(id); AssetBase fullAsset;
if (!m_Cache.Get(id, out fullAsset))
return null;
if (fullAsset != null) if (fullAsset != null)
return fullAsset.Data; return fullAsset.Data;
@ -389,7 +400,10 @@ namespace OpenSim.Services.Connectors
AssetBase asset = null; AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
asset = m_Cache.Get(id); {
if (!m_Cache.Get(id, out asset))
return false;
}
if (asset == null || asset.Data == null || asset.Data.Length == 0) if (asset == null || asset.Data == null || asset.Data.Length == 0)
{ {
@ -590,7 +604,7 @@ namespace OpenSim.Services.Connectors
AssetBase asset = null; AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
asset = m_Cache.Get(id); m_Cache.Get(id, out asset);
if (asset == null) if (asset == null)
{ {

View File

@ -136,7 +136,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
// Cache fetch // Cache fetch
if (m_cache != null) if (m_cache != null)
{ {
AssetBase asset = m_cache.Get(id); AssetBase asset;
if (!m_cache.Get(id, out asset))
return null;
if (asset != null) if (asset != null)
return asset; return asset;
} }
@ -147,8 +149,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
public AssetBase GetCached(string id) public AssetBase GetCached(string id)
{ {
AssetBase asset;
if (m_cache != null) if (m_cache != null)
return m_cache.Get(id); m_cache.Get(id, out asset);
return null; return null;
} }
@ -169,7 +172,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
// Cache fetch // Cache fetch
if (m_cache != null) if (m_cache != null)
{ {
AssetBase asset = m_cache.Get(id); AssetBase asset;
if (!m_cache.Get(id, out asset))
return null;
if (asset != null) if (asset != null)
return asset.Metadata; return asset.Metadata;
} }
@ -212,7 +217,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
// Cache fetch // Cache fetch
if (m_cache != null) if (m_cache != null)
{ {
AssetBase asset = m_cache.Get(id); AssetBase asset;
if (!m_cache.Get(id, out asset))
return false;
if (asset != null) if (asset != null)
{ {
handler(id, sender, asset); handler(id, sender, asset);