diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 2b3f7f5..da39202 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -301,7 +301,9 @@ namespace Flotsam.RegionModules.AssetCache | |||
301 | } | 301 | } |
302 | catch (Exception e) | 302 | catch (Exception e) |
303 | { | 303 | { |
304 | LogException(e); | 304 | m_log.ErrorFormat( |
305 | "[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}", | ||
306 | asset.ID, e.Message, e.StackTrace); | ||
305 | } | 307 | } |
306 | } | 308 | } |
307 | 309 | ||
@@ -361,7 +363,9 @@ namespace Flotsam.RegionModules.AssetCache | |||
361 | } | 363 | } |
362 | catch (System.Runtime.Serialization.SerializationException e) | 364 | catch (System.Runtime.Serialization.SerializationException e) |
363 | { | 365 | { |
364 | LogException(e); | 366 | m_log.ErrorFormat( |
367 | "[FLOTSAM ASSET CACHE]: Failed to get file {0} for asset {1}. Exception {2} {3}", | ||
368 | filename, id, e.Message, e.StackTrace); | ||
365 | 369 | ||
366 | // If there was a problem deserializing the asset, the asset may | 370 | // If there was a problem deserializing the asset, the asset may |
367 | // either be corrupted OR was serialized under an old format | 371 | // either be corrupted OR was serialized under an old format |
@@ -371,7 +375,9 @@ namespace Flotsam.RegionModules.AssetCache | |||
371 | } | 375 | } |
372 | catch (Exception e) | 376 | catch (Exception e) |
373 | { | 377 | { |
374 | LogException(e); | 378 | m_log.ErrorFormat( |
379 | "[FLOTSAM ASSET CACHE]: Failed to get file {0} for asset {1}. Exception {2} {3}", | ||
380 | filename, id, e.Message, e.StackTrace); | ||
375 | } | 381 | } |
376 | finally | 382 | finally |
377 | { | 383 | { |
@@ -380,7 +386,6 @@ namespace Flotsam.RegionModules.AssetCache | |||
380 | } | 386 | } |
381 | } | 387 | } |
382 | 388 | ||
383 | |||
384 | #if WAIT_ON_INPROGRESS_REQUESTS | 389 | #if WAIT_ON_INPROGRESS_REQUESTS |
385 | // Check if we're already downloading this asset. If so, try to wait for it to | 390 | // Check if we're already downloading this asset. If so, try to wait for it to |
386 | // download. | 391 | // download. |
@@ -403,7 +408,6 @@ namespace Flotsam.RegionModules.AssetCache | |||
403 | m_RequestsForInprogress++; | 408 | m_RequestsForInprogress++; |
404 | } | 409 | } |
405 | #endif | 410 | #endif |
406 | |||
407 | return asset; | 411 | return asset; |
408 | } | 412 | } |
409 | 413 | ||
@@ -415,7 +419,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
415 | 419 | ||
416 | if (m_MemoryCacheEnabled) | 420 | if (m_MemoryCacheEnabled) |
417 | asset = GetFromMemoryCache(id); | 421 | asset = GetFromMemoryCache(id); |
418 | else if (m_FileCacheEnabled) | 422 | if (asset == null && m_FileCacheEnabled) |
419 | asset = GetFromFileCache(id); | 423 | asset = GetFromFileCache(id); |
420 | 424 | ||
421 | if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0)) | 425 | if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0)) |
@@ -432,7 +436,6 @@ namespace Flotsam.RegionModules.AssetCache | |||
432 | } | 436 | } |
433 | 437 | ||
434 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} unnessesary requests due to requests for assets that are currently downloading.", m_RequestsForInprogress); | 438 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} unnessesary requests due to requests for assets that are currently downloading.", m_RequestsForInprogress); |
435 | |||
436 | } | 439 | } |
437 | 440 | ||
438 | return asset; | 441 | return asset; |
@@ -446,7 +449,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
446 | public void Expire(string id) | 449 | public void Expire(string id) |
447 | { | 450 | { |
448 | if (m_LogLevel >= 2) | 451 | if (m_LogLevel >= 2) |
449 | m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Expiring Asset {0}.", id); | 452 | m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Expiring Asset {0}", id); |
450 | 453 | ||
451 | try | 454 | try |
452 | { | 455 | { |
@@ -464,7 +467,9 @@ namespace Flotsam.RegionModules.AssetCache | |||
464 | } | 467 | } |
465 | catch (Exception e) | 468 | catch (Exception e) |
466 | { | 469 | { |
467 | LogException(e); | 470 | m_log.ErrorFormat( |
471 | "[FLOTSAM ASSET CACHE]: Failed to expire cached file {0}. Exception {1} {2}", | ||
472 | id, e.Message, e.StackTrace); | ||
468 | } | 473 | } |
469 | } | 474 | } |
470 | 475 | ||
@@ -602,7 +607,9 @@ namespace Flotsam.RegionModules.AssetCache | |||
602 | } | 607 | } |
603 | catch (Exception e) | 608 | catch (Exception e) |
604 | { | 609 | { |
605 | LogException(e); | 610 | m_log.ErrorFormat( |
611 | "[FLOTSAM ASSET CACHE]: Failed to write asset {0} to cache. Directory {1}, tempname {2}, filename {3}. Exception {4} {5}.", | ||
612 | asset.ID, directory, tempname, filename, e.Message, e.StackTrace); | ||
606 | } | 613 | } |
607 | finally | 614 | finally |
608 | { | 615 | { |
@@ -632,15 +639,6 @@ namespace Flotsam.RegionModules.AssetCache | |||
632 | } | 639 | } |
633 | } | 640 | } |
634 | 641 | ||
635 | private static void LogException(Exception e) | ||
636 | { | ||
637 | string[] text = e.ToString().Split(new char[] { '\n' }); | ||
638 | foreach (string t in text) | ||
639 | { | ||
640 | m_log.ErrorFormat("[FLOTSAM ASSET CACHE]: {0} ", t); | ||
641 | } | ||
642 | } | ||
643 | |||
644 | /// <summary> | 642 | /// <summary> |
645 | /// Scan through the file cache, and return number of assets currently cached. | 643 | /// Scan through the file cache, and return number of assets currently cached. |
646 | /// </summary> | 644 | /// </summary> |
@@ -693,8 +691,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
693 | s.ForEachSOG(delegate(SceneObjectGroup e) | 691 | s.ForEachSOG(delegate(SceneObjectGroup e) |
694 | { | 692 | { |
695 | gatherer.GatherAssetUuids(e, assets); | 693 | gatherer.GatherAssetUuids(e, assets); |
696 | } | 694 | }); |
697 | ); | ||
698 | } | 695 | } |
699 | 696 | ||
700 | foreach (UUID assetID in assets.Keys) | 697 | foreach (UUID assetID in assets.Keys) |
@@ -727,7 +724,9 @@ namespace Flotsam.RegionModules.AssetCache | |||
727 | } | 724 | } |
728 | catch (Exception e) | 725 | catch (Exception e) |
729 | { | 726 | { |
730 | LogException(e); | 727 | m_log.ErrorFormat( |
728 | "[FLOTSAM ASSET CACHE]: Couldn't clear asset cache directory {0} from {1}. Exception {2} {3}", | ||
729 | dir, m_CacheDirectory, e.Message, e.StackTrace); | ||
731 | } | 730 | } |
732 | } | 731 | } |
733 | 732 | ||
@@ -739,7 +738,9 @@ namespace Flotsam.RegionModules.AssetCache | |||
739 | } | 738 | } |
740 | catch (Exception e) | 739 | catch (Exception e) |
741 | { | 740 | { |
742 | LogException(e); | 741 | m_log.ErrorFormat( |
742 | "[FLOTSAM ASSET CACHE]: Couldn't clear asset cache file {0} from {1}. Exception {1} {2}", | ||
743 | file, m_CacheDirectory, e.Message, e.StackTrace); | ||
743 | } | 744 | } |
744 | } | 745 | } |
745 | } | 746 | } |
@@ -765,7 +766,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
765 | 766 | ||
766 | foreach (string s in Directory.GetFiles(m_CacheDirectory, "*.fac")) | 767 | foreach (string s in Directory.GetFiles(m_CacheDirectory, "*.fac")) |
767 | { | 768 | { |
768 | m_log.Info("[FLOTSAM ASSET CACHE]: Deep Scans were performed on the following regions:"); | 769 | m_log.Info("[FLOTSAM ASSET CACHE]: Deep scans have previously been performed on the following regions:"); |
769 | 770 | ||
770 | string RegionID = s.Remove(0,s.IndexOf("_")).Replace(".fac",""); | 771 | string RegionID = s.Remove(0,s.IndexOf("_")).Replace(".fac",""); |
771 | DateTime RegionDeepScanTMStamp = File.GetLastWriteTime(s); | 772 | DateTime RegionDeepScanTMStamp = File.GetLastWriteTime(s); |
@@ -836,7 +837,6 @@ namespace Flotsam.RegionModules.AssetCache | |||
836 | Util.FireAndForget(delegate { | 837 | Util.FireAndForget(delegate { |
837 | int assetsCached = CacheScenes(); | 838 | int assetsCached = CacheScenes(); |
838 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Completed Scene Caching, {0} assets found.", assetsCached); | 839 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Completed Scene Caching, {0} assets found.", assetsCached); |
839 | |||
840 | }); | 840 | }); |
841 | 841 | ||
842 | break; | 842 | break; |
@@ -891,7 +891,6 @@ namespace Flotsam.RegionModules.AssetCache | |||
891 | 891 | ||
892 | #region IAssetService Members | 892 | #region IAssetService Members |
893 | 893 | ||
894 | |||
895 | public AssetMetadata GetMetadata(string id) | 894 | public AssetMetadata GetMetadata(string id) |
896 | { | 895 | { |
897 | AssetBase asset = Get(id); | 896 | AssetBase asset = Get(id); |
@@ -921,7 +920,6 @@ namespace Flotsam.RegionModules.AssetCache | |||
921 | Cache(asset); | 920 | Cache(asset); |
922 | 921 | ||
923 | return asset.ID; | 922 | return asset.ID; |
924 | |||
925 | } | 923 | } |
926 | 924 | ||
927 | public bool UpdateContent(string id, byte[] data) | 925 | public bool UpdateContent(string id, byte[] data) |