diff options
author | UbitUmarov | 2012-07-11 20:54:55 +0100 |
---|---|---|
committer | UbitUmarov | 2012-07-11 20:54:55 +0100 |
commit | 236b5a0298659410c95129e6689cf192eb16fe4e (patch) | |
tree | 3b563898be22621abda09c0115f3808eba17b7e0 /OpenSim | |
parent | remove expensive and leaked ( in Xengine at least) SayShout timer and (diff) | |
download | opensim-SC_OLD-236b5a0298659410c95129e6689cf192eb16fe4e.zip opensim-SC_OLD-236b5a0298659410c95129e6689cf192eb16fe4e.tar.gz opensim-SC_OLD-236b5a0298659410c95129e6689cf192eb16fe4e.tar.bz2 opensim-SC_OLD-236b5a0298659410c95129e6689cf192eb16fe4e.tar.xz |
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.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs index 2882906..d8e0be4 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs | |||
@@ -55,7 +55,10 @@ namespace OpenSim.Services.Connectors | |||
55 | 55 | ||
56 | // Keeps track of concurrent requests for the same asset, so that it's only loaded once. | 56 | // Keeps track of concurrent requests for the same asset, so that it's only loaded once. |
57 | // Maps: Asset ID -> Handlers which will be called when the asset has been loaded | 57 | // Maps: Asset ID -> Handlers which will be called when the asset has been loaded |
58 | private Dictionary<string, AssetRetrievedEx> m_AssetHandlers = new Dictionary<string, AssetRetrievedEx>(); | 58 | // private Dictionary<string, AssetRetrievedEx> m_AssetHandlers = new Dictionary<string, AssetRetrievedEx>(); |
59 | |||
60 | private Dictionary<string, List<AssetRetrievedEx>> m_AssetHandlers = new Dictionary<string, List<AssetRetrievedEx>>(); | ||
61 | |||
59 | private Dictionary<string, string> m_UriMap = new Dictionary<string, string>(); | 62 | private Dictionary<string, string> m_UriMap = new Dictionary<string, string>(); |
60 | 63 | ||
61 | public AssetServicesConnector() | 64 | public AssetServicesConnector() |
@@ -269,16 +272,21 @@ namespace OpenSim.Services.Connectors | |||
269 | { | 272 | { |
270 | AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); | 273 | AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); |
271 | 274 | ||
272 | AssetRetrievedEx handlers; | 275 | // AssetRetrievedEx handlers; |
276 | List<AssetRetrievedEx> handlers; | ||
273 | if (m_AssetHandlers.TryGetValue(id, out handlers)) | 277 | if (m_AssetHandlers.TryGetValue(id, out handlers)) |
274 | { | 278 | { |
275 | // Someone else is already loading this asset. It will notify our handler when done. | 279 | // Someone else is already loading this asset. It will notify our handler when done. |
276 | handlers += handlerEx; | 280 | // handlers += handlerEx; |
281 | handlers.Add(handlerEx); | ||
277 | return true; | 282 | return true; |
278 | } | 283 | } |
279 | 284 | ||
280 | // Load the asset ourselves | 285 | // Load the asset ourselves |
281 | handlers += handlerEx; | 286 | // handlers += handlerEx; |
287 | handlers = new List<AssetRetrievedEx>(); | ||
288 | handlers.Add(handlerEx); | ||
289 | |||
282 | m_AssetHandlers.Add(id, handlers); | 290 | m_AssetHandlers.Add(id, handlers); |
283 | } | 291 | } |
284 | 292 | ||
@@ -290,14 +298,24 @@ namespace OpenSim.Services.Connectors | |||
290 | { | 298 | { |
291 | if (m_Cache != null) | 299 | if (m_Cache != null) |
292 | m_Cache.Cache(a); | 300 | m_Cache.Cache(a); |
293 | 301 | /* | |
294 | AssetRetrievedEx handlers; | 302 | AssetRetrievedEx handlers; |
295 | lock (m_AssetHandlers) | 303 | lock (m_AssetHandlers) |
296 | { | 304 | { |
297 | handlers = m_AssetHandlers[id]; | 305 | handlers = m_AssetHandlers[id]; |
298 | m_AssetHandlers.Remove(id); | 306 | m_AssetHandlers.Remove(id); |
299 | } | 307 | } |
308 | |||
300 | handlers.Invoke(a); | 309 | handlers.Invoke(a); |
310 | */ | ||
311 | List<AssetRetrievedEx> handlers; | ||
312 | lock (m_AssetHandlers) | ||
313 | { | ||
314 | handlers = m_AssetHandlers[id]; | ||
315 | m_AssetHandlers.Remove(id); | ||
316 | } | ||
317 | foreach (AssetRetrievedEx h in handlers) | ||
318 | h.Invoke(a); | ||
301 | }); | 319 | }); |
302 | 320 | ||
303 | success = true; | 321 | success = true; |