aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-03-30 01:21:16 +0000
committerJustin Clark-Casey (justincc)2013-03-30 01:21:16 +0000
commit9fee431cc8a054dd4d6b20392cbefd0a0f8343f1 (patch)
tree70bf67a8974f6cede205eb78c8cacb7f07138474 /OpenSim
parentrefactor: rename ETM.InformClientToInitateTeleportToLocationDelegate to Infor... (diff)
downloadopensim-SC_OLD-9fee431cc8a054dd4d6b20392cbefd0a0f8343f1.zip
opensim-SC_OLD-9fee431cc8a054dd4d6b20392cbefd0a0f8343f1.tar.gz
opensim-SC_OLD-9fee431cc8a054dd4d6b20392cbefd0a0f8343f1.tar.bz2
opensim-SC_OLD-9fee431cc8a054dd4d6b20392cbefd0a0f8343f1.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs52
1 files changed, 27 insertions, 25 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 3cba9b4..2afe065 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -341,11 +341,35 @@ namespace OpenSim.Region.CoreModules.Asset
341 /// <param name="id"></param> 341 /// <param name="id"></param>
342 /// <returns>An asset retrieved from the file cache. null if there was a problem retrieving an asset.</returns> 342 /// <returns>An asset retrieved from the file cache. null if there was a problem retrieving an asset.</returns>
343 private AssetBase GetFromFileCache(string id) 343 private AssetBase GetFromFileCache(string id)
344 { 344 {
345 AssetBase asset = null;
346
347 string filename = GetFileName(id); 345 string filename = GetFileName(id);
348 346
347#if WAIT_ON_INPROGRESS_REQUESTS
348 // Check if we're already downloading this asset. If so, try to wait for it to
349 // download.
350 if (m_WaitOnInprogressTimeout > 0)
351 {
352 m_RequestsForInprogress++;
353
354 ManualResetEvent waitEvent;
355 if (m_CurrentlyWriting.TryGetValue(filename, out waitEvent))
356 {
357 waitEvent.WaitOne(m_WaitOnInprogressTimeout);
358 return Get(id);
359 }
360 }
361#else
362 // Track how often we have the problem that an asset is requested while
363 // it is still being downloaded by a previous request.
364 if (m_CurrentlyWriting.Contains(filename))
365 {
366 m_RequestsForInprogress++;
367 return null;
368 }
369#endif
370
371 AssetBase asset = null;
372
349 if (File.Exists(filename)) 373 if (File.Exists(filename))
350 { 374 {
351 FileStream stream = null; 375 FileStream stream = null;
@@ -383,28 +407,6 @@ namespace OpenSim.Region.CoreModules.Asset
383 } 407 }
384 } 408 }
385 409
386#if WAIT_ON_INPROGRESS_REQUESTS
387 // Check if we're already downloading this asset. If so, try to wait for it to
388 // download.
389 if (m_WaitOnInprogressTimeout > 0)
390 {
391 m_RequestsForInprogress++;
392
393 ManualResetEvent waitEvent;
394 if (m_CurrentlyWriting.TryGetValue(filename, out waitEvent))
395 {
396 waitEvent.WaitOne(m_WaitOnInprogressTimeout);
397 return Get(id);
398 }
399 }
400#else
401 // Track how often we have the problem that an asset is requested while
402 // it is still being downloaded by a previous request.
403 if (m_CurrentlyWriting.Contains(filename))
404 {
405 m_RequestsForInprogress++;
406 }
407#endif
408 return asset; 410 return asset;
409 } 411 }
410 412