aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Serialization/TarArchiveWriter.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-05-14 20:37:54 +0000
committerJustin Clarke Casey2009-05-14 20:37:54 +0000
commit62771560448edbc2112d427acd4b37780dfe2154 (patch)
treeba07c1ae1d8de5e24e24a013fcaa39ade898f039 /OpenSim/Framework/Serialization/TarArchiveWriter.cs
parent* refactor: move SceneXmlLoader into subpackage (diff)
downloadopensim-SC_OLD-62771560448edbc2112d427acd4b37780dfe2154.zip
opensim-SC_OLD-62771560448edbc2112d427acd4b37780dfe2154.tar.gz
opensim-SC_OLD-62771560448edbc2112d427acd4b37780dfe2154.tar.bz2
opensim-SC_OLD-62771560448edbc2112d427acd4b37780dfe2154.tar.xz
* When saving an oar, save assets when immediately received rather than storing them all up in memory
* Hopefully this will remove out of memory problems when saving large oars on machines without much memory * It may also speed up saving of large oars
Diffstat (limited to 'OpenSim/Framework/Serialization/TarArchiveWriter.cs')
-rw-r--r--OpenSim/Framework/Serialization/TarArchiveWriter.cs39
1 files changed, 23 insertions, 16 deletions
diff --git a/OpenSim/Framework/Serialization/TarArchiveWriter.cs b/OpenSim/Framework/Serialization/TarArchiveWriter.cs
index d319b0b..316a8de 100644
--- a/OpenSim/Framework/Serialization/TarArchiveWriter.cs
+++ b/OpenSim/Framework/Serialization/TarArchiveWriter.cs
@@ -109,10 +109,14 @@ namespace OpenSim.Framework.Serialization
109 109
110 // Write two consecutive 0 blocks to end the archive 110 // Write two consecutive 0 blocks to end the archive
111 byte[] finalZeroPadding = new byte[1024]; 111 byte[] finalZeroPadding = new byte[1024];
112 m_bw.Write(finalZeroPadding);
113 112
114 m_bw.Flush(); 113 lock (m_bw)
115 m_bw.Close(); 114 {
115 m_bw.Write(finalZeroPadding);
116
117 m_bw.Flush();
118 m_bw.Close();
119 }
116 } 120 }
117 121
118 public static byte[] ConvertDecimalToPaddedOctalBytes(int d, int padding) 122 public static byte[] ConvertDecimalToPaddedOctalBytes(int d, int padding)
@@ -197,20 +201,23 @@ namespace OpenSim.Framework.Serialization
197 201
198 header[154] = 0; 202 header[154] = 0;
199 203
200 // Write out header 204 lock (m_bw)
201 m_bw.Write(header);
202
203 // Write out data
204 m_bw.Write(data);
205
206 if (data.Length % 512 != 0)
207 { 205 {
208 int paddingRequired = 512 - (data.Length % 512); 206 // Write out header
209 207 m_bw.Write(header);
210 //m_log.DebugFormat("[TAR ARCHIVE WRITER]: Padding data with {0} bytes", paddingRequired); 208
211 209 // Write out data
212 byte[] padding = new byte[paddingRequired]; 210 m_bw.Write(data);
213 m_bw.Write(padding); 211
212 if (data.Length % 512 != 0)
213 {
214 int paddingRequired = 512 - (data.Length % 512);
215
216 //m_log.DebugFormat("[TAR ARCHIVE WRITER]: Padding data with {0} bytes", paddingRequired);
217
218 byte[] padding = new byte[paddingRequired];
219 m_bw.Write(padding);
220 }
214 } 221 }
215 } 222 }
216 } 223 }