aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs34
1 files changed, 29 insertions, 5 deletions
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
index 2882906..45ebf3a 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.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,26 @@ 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);
319 if (handlers != null)
320 handlers.Clear();
301 }); 321 });
302 322
303 success = true; 323 success = true;
@@ -306,10 +326,14 @@ namespace OpenSim.Services.Connectors
306 { 326 {
307 if (!success) 327 if (!success)
308 { 328 {
329 List<AssetRetrievedEx> handlers;
309 lock (m_AssetHandlers) 330 lock (m_AssetHandlers)
310 { 331 {
332 handlers = m_AssetHandlers[id];
311 m_AssetHandlers.Remove(id); 333 m_AssetHandlers.Remove(id);
312 } 334 }
335 if (handlers != null)
336 handlers.Clear();
313 } 337 }
314 } 338 }
315 } 339 }