aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Asset
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-05 19:57:47 +0100
committerJustin Clark-Casey (justincc)2011-08-05 19:57:47 +0100
commit1a2518d19bb447f4d3821cb71e32e712cc99d9c0 (patch)
tree2987f4f55641a924f8e88abbdd3d521ad2c014af /OpenSim/Region/CoreModules/Asset
parentremove the largely unused copy/pasted HandleAgentRequestSit() method (diff)
downloadopensim-SC-1a2518d19bb447f4d3821cb71e32e712cc99d9c0.zip
opensim-SC-1a2518d19bb447f4d3821cb71e32e712cc99d9c0.tar.gz
opensim-SC-1a2518d19bb447f4d3821cb71e32e712cc99d9c0.tar.bz2
opensim-SC-1a2518d19bb447f4d3821cb71e32e712cc99d9c0.tar.xz
Instead of moving the file to its final place when FlotsamCache writes to disk, copy it instead.
This is to eliminate IOException where two threads compete to cache the same file.
Diffstat (limited to 'OpenSim/Region/CoreModules/Asset')
-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