From d2e380e81e549ccce316ef873502f66ba6806642 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 3 Nov 2016 16:56:09 +0000 Subject: [PATCH] on get asset with callback, do the callback even if asset not found. This is needed on same cases --- .../Asset/AssetServicesConnector.cs | 53 +++++++------------ 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 99119d33ee..a6e8eb424b 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -347,51 +347,34 @@ namespace OpenSim.Services.Connectors string uri = r.uri; string id = r.id; - bool success = false; try { AssetBase a = SynchronousRestObjectRequester.MakeRequest("GET", uri, 0, 30000, m_Auth); - if (a != null) + + if (a != null && m_Cache != null) + m_Cache.Cache(a); + + List handlers; + lock (m_AssetHandlers) { - if (m_Cache != null) - m_Cache.Cache(a); + handlers = m_AssetHandlers[id]; + m_AssetHandlers.Remove(id); + } - List handlers; - lock (m_AssetHandlers) + if(handlers != null) + { + Util.FireAndForget(x => { - handlers = m_AssetHandlers[id]; - m_AssetHandlers.Remove(id); - } - - if(handlers != null) - { - Util.FireAndForget(x => + foreach (AssetRetrievedEx h in handlers) { - foreach (AssetRetrievedEx h in handlers) - { - try { h.Invoke(a); } - catch { } - } - handlers.Clear(); - }); - } - success = true; - } - } - finally - { - if (!success) - { - List handlers; - lock (m_AssetHandlers) - { - handlers = m_AssetHandlers[id]; - m_AssetHandlers.Remove(id); - } - if (handlers != null) + try { h.Invoke(a); } + catch { } + } handlers.Clear(); + }); } } + catch { } } }