In the flotasm asset cache, if we get a request for a file that we're actively writing, simply return null instead of first logging an exception.

user_profiles
Justin Clark-Casey (justincc) 2013-03-30 01:21:16 +00:00
parent f8785b5f47
commit 9fee431cc8
1 changed files with 27 additions and 25 deletions

View File

@ -341,11 +341,35 @@ namespace OpenSim.Region.CoreModules.Asset
/// <param name="id"></param>
/// <returns>An asset retrieved from the file cache. null if there was a problem retrieving an asset.</returns>
private AssetBase GetFromFileCache(string id)
{
AssetBase asset = null;
{
string filename = GetFileName(id);
#if WAIT_ON_INPROGRESS_REQUESTS
// Check if we're already downloading this asset. If so, try to wait for it to
// download.
if (m_WaitOnInprogressTimeout > 0)
{
m_RequestsForInprogress++;
ManualResetEvent waitEvent;
if (m_CurrentlyWriting.TryGetValue(filename, out waitEvent))
{
waitEvent.WaitOne(m_WaitOnInprogressTimeout);
return Get(id);
}
}
#else
// Track how often we have the problem that an asset is requested while
// it is still being downloaded by a previous request.
if (m_CurrentlyWriting.Contains(filename))
{
m_RequestsForInprogress++;
return null;
}
#endif
AssetBase asset = null;
if (File.Exists(filename))
{
FileStream stream = null;
@ -383,28 +407,6 @@ namespace OpenSim.Region.CoreModules.Asset
}
}
#if WAIT_ON_INPROGRESS_REQUESTS
// Check if we're already downloading this asset. If so, try to wait for it to
// download.
if (m_WaitOnInprogressTimeout > 0)
{
m_RequestsForInprogress++;
ManualResetEvent waitEvent;
if (m_CurrentlyWriting.TryGetValue(filename, out waitEvent))
{
waitEvent.WaitOne(m_WaitOnInprogressTimeout);
return Get(id);
}
}
#else
// Track how often we have the problem that an asset is requested while
// it is still being downloaded by a previous request.
if (m_CurrentlyWriting.Contains(filename))
{
m_RequestsForInprogress++;
}
#endif
return asset;
}