aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index da39202..0c700e3 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -600,7 +600,13 @@ namespace Flotsam.RegionModules.AssetCache
600 stream.Close(); 600 stream.Close();
601 601
602 // Now that it's written, rename it so that it can be found. 602 // Now that it's written, rename it so that it can be found.
603 File.Move(tempname, filename); 603 // We're doing this as a file copy operation so that if two threads are competing to cache this asset,
604 // then both suceed instead of one failing when it tries to move the file to a final filename that
605 // already exists.
606 // This assumes that the file copy operation is atomic. Assuming this holds, then copying also works
607 // if another simulator is using the same cache directory.
608 File.Copy(tempname, filename, true);
609 File.Delete(tempname);
604 610
605 if (m_LogLevel >= 2) 611 if (m_LogLevel >= 2)
606 m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Cache Stored :: {0}", asset.ID); 612 m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Cache Stored :: {0}", asset.ID);
@@ -635,7 +641,6 @@ namespace Flotsam.RegionModules.AssetCache
635 } 641 }
636#endif 642#endif
637 } 643 }
638
639 } 644 }
640 } 645 }
641 646