From 60c99756ed24d4a310a935b1670f048b635f6c17 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Oct 2021 18:17:28 +0100 Subject: [PATCH] add some missing using(... --- .../LoadRegions/RegionLoaderWebServer.cs | 16 +++++++++------- OpenSim/Region/Application/OpenSim.cs | 10 ++++++---- OpenSim/Region/Application/OpenSimBase.cs | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs index 2cfd4938c1..7b9dbd48cb 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs @@ -80,16 +80,18 @@ namespace OpenSim.ApplicationPlugins.LoadRegions try { - HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); - m_log.Debug("[WEBLOADER]: Downloading region information..."); - StreamReader reader = new StreamReader(webResponse.GetResponseStream()); string xmlSource = String.Empty; - string tempStr = reader.ReadLine(); - while (tempStr != null) + m_log.Debug("[WEBLOADER]: Downloading region information..."); + using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse()) + using (StreamReader reader = new StreamReader(webResponse.GetResponseStream())) { - xmlSource = xmlSource + tempStr; - tempStr = reader.ReadLine(); + string tempStr; + while ((tempStr = reader.ReadLine()) != null) + { + xmlSource += tempStr; + } } + m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + xmlSource.Length); XmlDocument xmlDoc = new XmlDocument(); diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 12979ff040..21e36ae97e 100755 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -559,11 +559,13 @@ namespace OpenSim { if (File.Exists(fileName)) { - StreamReader readFile = File.OpenText(fileName); - string currentLine; - while ((currentLine = readFile.ReadLine()) != null) + using(StreamReader readFile = File.OpenText(fileName)) { - m_log.Info("[!]" + currentLine); + string currentLine; + while ((currentLine = readFile.ReadLine()) != null) + { + m_log.Info("[!]" + currentLine); + } } } } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f3d670faf9..ad90bdaac0 100755 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -353,7 +353,6 @@ namespace OpenSim if (startupConfig == null || startupConfig.GetBoolean("JobEngineEnabled", true)) WorkManager.JobEngine.Start(); - if(m_networkServersInfo.HttpUsesSSL) { m_httpServerSSL = true; @@ -449,6 +448,7 @@ namespace OpenSim Scene scene = SetupScene(regionInfo, proxyOffset, Config); m_log.Info("[REGIONMODULES]: Loading Region's modules"); + if (controller != null) controller.AddRegionToModules(scene);