Fix threading in remote asset connector

avinationmerge
Melanie 2012-10-05 00:15:55 +02:00
parent efb9b7014e
commit d5ea203f93
1 changed files with 21 additions and 16 deletions

View File

@ -295,25 +295,30 @@ namespace OpenSim.Services.Connectors
bool success = false; bool success = false;
try try
{ {
AsynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, AssetBase a = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, 30);
delegate(AssetBase a) if (a != null)
{
if (m_Cache != null)
m_Cache.Cache(a);
List<AssetRetrievedEx> handlers;
lock (m_AssetHandlers)
{ {
if (m_Cache != null) handlers = m_AssetHandlers[id];
m_Cache.Cache(a); m_AssetHandlers.Remove(id);
}
List<AssetRetrievedEx> handlers; foreach (AssetRetrievedEx h in handlers)
lock (m_AssetHandlers) {
Util.FireAndForget(x =>
{ {
handlers = m_AssetHandlers[id];
m_AssetHandlers.Remove(id);
}
foreach (AssetRetrievedEx h in handlers)
h.Invoke(a); h.Invoke(a);
if (handlers != null) });
handlers.Clear(); }
}, 30); if (handlers != null)
handlers.Clear();
success = true; success = true;
}
} }
finally finally
{ {
@ -326,7 +331,7 @@ namespace OpenSim.Services.Connectors
m_AssetHandlers.Remove(id); m_AssetHandlers.Remove(id);
} }
if (handlers != null) if (handlers != null)
handlers.Clear(); handlers.Clear();
} }
} }
} }