diff options
author | Oren Hurvitz | 2014-06-01 17:39:11 +0300 |
---|---|---|
committer | Oren Hurvitz | 2014-07-21 08:30:03 +0100 |
commit | 99ac770abbe3a95887c4b10c82f3985aa878eeef (patch) | |
tree | 8c946dab083dd50a352f3861415eca43185d8d95 /OpenSim/Region/CoreModules/World/Archiver | |
parent | Set "[Terrain]SendTerrainUpdatesByViewDistance=true" by default. (diff) | |
download | opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.zip opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.gz opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.bz2 opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.xz |
Close streams immediately when we finish using them
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 19 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs | 9 |
2 files changed, 15 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index e9c6fb6..c8056d4 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -918,17 +918,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
918 | { | 918 | { |
919 | ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); | 919 | ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); |
920 | 920 | ||
921 | MemoryStream ms = new MemoryStream(data); | 921 | using (MemoryStream ms = new MemoryStream(data)) |
922 | if (m_displacement != Vector3.Zero || m_rotation != 0f) | ||
923 | { | 922 | { |
924 | Vector2 rotationCenter = new Vector2(m_rotationCenter.X, m_rotationCenter.Y); | 923 | if (m_displacement != Vector3.Zero || m_rotation != 0f) |
925 | terrainModule.LoadFromStream(terrainPath, m_displacement, m_rotation, rotationCenter, ms); | 924 | { |
926 | } | 925 | Vector2 rotationCenter = new Vector2(m_rotationCenter.X, m_rotationCenter.Y); |
927 | else | 926 | terrainModule.LoadFromStream(terrainPath, m_displacement, m_rotation, rotationCenter, ms); |
928 | { | 927 | } |
929 | terrainModule.LoadFromStream(terrainPath, ms); | 928 | else |
929 | { | ||
930 | terrainModule.LoadFromStream(terrainPath, ms); | ||
931 | } | ||
930 | } | 932 | } |
931 | ms.Close(); | ||
932 | 933 | ||
933 | m_log.DebugFormat("[ARCHIVER]: Restored terrain {0}", terrainPath); | 934 | m_log.DebugFormat("[ARCHIVER]: Restored terrain {0}", terrainPath); |
934 | 935 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs index 136a16e..448147a 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs | |||
@@ -569,10 +569,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
569 | string terrainPath = String.Format("{0}{1}{2}.r32", | 569 | string terrainPath = String.Format("{0}{1}{2}.r32", |
570 | regionDir, ArchiveConstants.TERRAINS_PATH, scene.RegionInfo.RegionName); | 570 | regionDir, ArchiveConstants.TERRAINS_PATH, scene.RegionInfo.RegionName); |
571 | 571 | ||
572 | MemoryStream ms = new MemoryStream(); | 572 | using (MemoryStream ms = new MemoryStream()) |
573 | scene.RequestModuleInterface<ITerrainModule>().SaveToStream(terrainPath, ms); | 573 | { |
574 | m_archiveWriter.WriteFile(terrainPath, ms.ToArray()); | 574 | scene.RequestModuleInterface<ITerrainModule>().SaveToStream(terrainPath, ms); |
575 | ms.Close(); | 575 | m_archiveWriter.WriteFile(terrainPath, ms.ToArray()); |
576 | } | ||
576 | 577 | ||
577 | m_log.InfoFormat("[ARCHIVER]: Adding scene objects to archive."); | 578 | m_log.InfoFormat("[ARCHIVER]: Adding scene objects to archive."); |
578 | 579 | ||