diff options
author | Justin Clark-Casey (justincc) | 2013-02-27 00:21:02 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-27 00:21:02 +0000 |
commit | 80c19b7cac52a57fd04966169c657400aeee3de8 (patch) | |
tree | 32c48c0d00da28ed091d8c6a671d43d1e9ab8bdb /OpenSim/Region/CoreModules/World/WorldMap | |
parent | minor: Remove unnecessary very old System.Net reference in OpenSim.Region.Scr... (diff) | |
download | opensim-SC_OLD-80c19b7cac52a57fd04966169c657400aeee3de8.zip opensim-SC_OLD-80c19b7cac52a57fd04966169c657400aeee3de8.tar.gz opensim-SC_OLD-80c19b7cac52a57fd04966169c657400aeee3de8.tar.bz2 opensim-SC_OLD-80c19b7cac52a57fd04966169c657400aeee3de8.tar.xz |
Make sure we dispose of WebResponse, StreamReader and Stream in various places where we were not already.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/WorldMap')
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 912d50a..c50ab64 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -868,20 +868,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
868 | } | 868 | } |
869 | 869 | ||
870 | string response_mapItems_reply = null; | 870 | string response_mapItems_reply = null; |
871 | { // get the response | 871 | { |
872 | StreamReader sr = null; | ||
873 | try | 872 | try |
874 | { | 873 | { |
875 | WebResponse webResponse = mapitemsrequest.GetResponse(); | 874 | using (WebResponse webResponse = mapitemsrequest.GetResponse()) |
876 | if (webResponse != null) | ||
877 | { | ||
878 | sr = new StreamReader(webResponse.GetResponseStream()); | ||
879 | response_mapItems_reply = sr.ReadToEnd().Trim(); | ||
880 | } | ||
881 | else | ||
882 | { | 875 | { |
883 | return new OSDMap(); | 876 | if (webResponse != null) |
884 | } | 877 | { |
878 | using (Stream s = webResponse.GetResponseStream()) | ||
879 | using (StreamReader sr = new StreamReader(s)) | ||
880 | response_mapItems_reply = sr.ReadToEnd().Trim(); | ||
881 | } | ||
882 | else | ||
883 | { | ||
884 | return new OSDMap(); | ||
885 | } | ||
886 | } | ||
885 | } | 887 | } |
886 | catch (WebException) | 888 | catch (WebException) |
887 | { | 889 | { |
@@ -908,11 +910,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
908 | 910 | ||
909 | return responseMap; | 911 | return responseMap; |
910 | } | 912 | } |
911 | finally | ||
912 | { | ||
913 | if (sr != null) | ||
914 | sr.Close(); | ||
915 | } | ||
916 | 913 | ||
917 | OSD rezResponse = null; | 914 | OSD rezResponse = null; |
918 | try | 915 | try |
@@ -926,6 +923,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
926 | { | 923 | { |
927 | m_log.InfoFormat("[WORLD MAP]: exception on parse of RequestMapItems reply from {0}: {1}", httpserver, ex.Message); | 924 | m_log.InfoFormat("[WORLD MAP]: exception on parse of RequestMapItems reply from {0}: {1}", httpserver, ex.Message); |
928 | responseMap["connect"] = OSD.FromBoolean(false); | 925 | responseMap["connect"] = OSD.FromBoolean(false); |
926 | |||
929 | lock (m_blacklistedregions) | 927 | lock (m_blacklistedregions) |
930 | { | 928 | { |
931 | if (!m_blacklistedregions.ContainsKey(regionhandle)) | 929 | if (!m_blacklistedregions.ContainsKey(regionhandle)) |