diff options
author | Justin Clark-Casey (justincc) | 2009-11-24 17:47:09 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-11-24 17:47:09 +0000 |
commit | c083ab682425d13a7369e3f82c82ccbc3c65102a (patch) | |
tree | 6bc52c9aaa6a45d44c2152eceb3301b8e9e2bcc6 /OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |
parent | minor: remove some mono compiler warnings (diff) | |
download | opensim-SC_OLD-c083ab682425d13a7369e3f82c82ccbc3c65102a.zip opensim-SC_OLD-c083ab682425d13a7369e3f82c82ccbc3c65102a.tar.gz opensim-SC_OLD-c083ab682425d13a7369e3f82c82ccbc3c65102a.tar.bz2 opensim-SC_OLD-c083ab682425d13a7369e3f82c82ccbc3c65102a.tar.xz |
make save and load oar slightly more robust by always closing the archive streams even if there has been an error
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 70a225e..34b81d8 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -103,14 +103,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
103 | List<string> serialisedSceneObjects = new List<string>(); | 103 | List<string> serialisedSceneObjects = new List<string>(); |
104 | List<string> serialisedParcels = new List<string>(); | 104 | List<string> serialisedParcels = new List<string>(); |
105 | string filePath = "NONE"; | 105 | string filePath = "NONE"; |
106 | |||
107 | TarArchiveReader archive = new TarArchiveReader(m_loadStream); | ||
108 | byte[] data; | ||
109 | TarArchiveReader.TarEntryType entryType; | ||
106 | 110 | ||
107 | try | 111 | try |
108 | { | 112 | { |
109 | TarArchiveReader archive = new TarArchiveReader(m_loadStream); | ||
110 | |||
111 | byte[] data; | ||
112 | TarArchiveReader.TarEntryType entryType; | ||
113 | |||
114 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) | 113 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) |
115 | { | 114 | { |
116 | //m_log.DebugFormat( | 115 | //m_log.DebugFormat( |
@@ -152,8 +151,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
152 | } | 151 | } |
153 | 152 | ||
154 | //m_log.Debug("[ARCHIVER]: Reached end of archive"); | 153 | //m_log.Debug("[ARCHIVER]: Reached end of archive"); |
155 | |||
156 | archive.Close(); | ||
157 | } | 154 | } |
158 | catch (Exception e) | 155 | catch (Exception e) |
159 | { | 156 | { |
@@ -163,6 +160,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
163 | m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); | 160 | m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); |
164 | return; | 161 | return; |
165 | } | 162 | } |
163 | finally | ||
164 | { | ||
165 | archive.Close(); | ||
166 | } | ||
166 | 167 | ||
167 | m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); | 168 | m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); |
168 | 169 | ||