aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Base/ServerUtils.cs
diff options
context:
space:
mode:
authorOren Hurvitz2014-06-01 17:39:11 +0300
committerOren Hurvitz2014-07-21 08:30:03 +0100
commit99ac770abbe3a95887c4b10c82f3985aa878eeef (patch)
tree8c946dab083dd50a352f3861415eca43185d8d95 /OpenSim/Server/Base/ServerUtils.cs
parentSet "[Terrain]SendTerrainUpdatesByViewDistance=true" by default. (diff)
downloadopensim-SC_OLD-99ac770abbe3a95887c4b10c82f3985aa878eeef.zip
opensim-SC_OLD-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.gz
opensim-SC_OLD-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.bz2
opensim-SC_OLD-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.xz
Close streams immediately when we finish using them
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs20
1 files changed, 11 insertions, 9 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index c92e23c..8f1d56b 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -196,17 +196,19 @@ namespace OpenSim.Server.Base
196 196
197 public static byte[] SerializeResult(XmlSerializer xs, object data) 197 public static byte[] SerializeResult(XmlSerializer xs, object data)
198 { 198 {
199 MemoryStream ms = new MemoryStream(); 199 using (MemoryStream ms = new MemoryStream())
200 XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8); 200 using (XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8))
201 xw.Formatting = Formatting.Indented; 201 {
202 xs.Serialize(xw, data); 202 xw.Formatting = Formatting.Indented;
203 xw.Flush(); 203 xs.Serialize(xw, data);
204 xw.Flush();
204 205
205 ms.Seek(0, SeekOrigin.Begin); 206 ms.Seek(0, SeekOrigin.Begin);
206 byte[] ret = ms.GetBuffer(); 207 byte[] ret = ms.GetBuffer();
207 Array.Resize(ref ret, (int)ms.Length); 208 Array.Resize(ref ret, (int)ms.Length);
208 209
209 return ret; 210 return ret;
211 }
210 } 212 }
211 213
212 /// <summary> 214 /// <summary>