From 236b5a0298659410c95129e6689cf192eb16fe4e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 11 Jul 2012 20:54:55 +0100 Subject: [PATCH] Replace a Multicast Delegate by a simple list of delegates in access Get Can't seen more than one evocation on the multicast on this case, even expanding its evocation list (as it should be used in case one fails). With the list i do see what we want. --- .../Connectors/Asset/AssetServiceConnector.cs | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs index 2882906792..d8e0be482a 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs @@ -55,7 +55,10 @@ namespace OpenSim.Services.Connectors // Keeps track of concurrent requests for the same asset, so that it's only loaded once. // Maps: Asset ID -> Handlers which will be called when the asset has been loaded - private Dictionary m_AssetHandlers = new Dictionary(); +// private Dictionary m_AssetHandlers = new Dictionary(); + + private Dictionary> m_AssetHandlers = new Dictionary>(); + private Dictionary m_UriMap = new Dictionary(); public AssetServicesConnector() @@ -269,16 +272,21 @@ namespace OpenSim.Services.Connectors { AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); - AssetRetrievedEx handlers; +// AssetRetrievedEx handlers; + List handlers; if (m_AssetHandlers.TryGetValue(id, out handlers)) { // Someone else is already loading this asset. It will notify our handler when done. - handlers += handlerEx; +// handlers += handlerEx; + handlers.Add(handlerEx); return true; } // Load the asset ourselves - handlers += handlerEx; +// handlers += handlerEx; + handlers = new List(); + handlers.Add(handlerEx); + m_AssetHandlers.Add(id, handlers); } @@ -290,14 +298,24 @@ namespace OpenSim.Services.Connectors { if (m_Cache != null) m_Cache.Cache(a); - +/* AssetRetrievedEx handlers; lock (m_AssetHandlers) { handlers = m_AssetHandlers[id]; m_AssetHandlers.Remove(id); } + handlers.Invoke(a); +*/ + List handlers; + lock (m_AssetHandlers) + { + handlers = m_AssetHandlers[id]; + m_AssetHandlers.Remove(id); + } + foreach (AssetRetrievedEx h in handlers) + h.Invoke(a); }); success = true;