diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 52 |
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 | ||