aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs28
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;