aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Estate
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/Region/CoreModules/World/Estate
parentSet "[Terrain]SendTerrainUpdatesByViewDistance=true" by default. (diff)
downloadopensim-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/Estate')
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs12
2 files changed, 3 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 9fac9ff..80fa08a 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -1121,9 +1121,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
1121 { 1121 {
1122 try 1122 try
1123 { 1123 {
1124 MemoryStream terrainStream = new MemoryStream(terrainData); 1124 using (MemoryStream terrainStream = new MemoryStream(terrainData))
1125 terr.LoadFromStream(filename, terrainStream); 1125 terr.LoadFromStream(filename, terrainStream);
1126 terrainStream.Close();
1127 1126
1128 FileInfo x = new FileInfo(filename); 1127 FileInfo x = new FileInfo(filename);
1129 remoteClient.SendAlertMessage("Your terrain was loaded as a " + x.Extension + " file. It may take a few moments to appear."); 1128 remoteClient.SendAlertMessage("Your terrain was loaded as a " + x.Extension + " file. It may take a few moments to appear.");
diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs
index 2366767..ec5af2b 100644
--- a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs
@@ -281,18 +281,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
281 281
282 rootElement.AppendChild(result); 282 rootElement.AppendChild(result);
283 283
284 return DocToBytes(doc); 284 return Util.DocToBytes(doc);
285 } 285 }
286 286
287 private byte[] DocToBytes(XmlDocument doc)
288 {
289 MemoryStream ms = new MemoryStream();
290 XmlTextWriter xw = new XmlTextWriter(ms, null);
291 xw.Formatting = Formatting.Indented;
292 doc.WriteTo(xw);
293 xw.Flush();
294
295 return ms.ToArray();
296 }
297 } 287 }
298} 288}