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/OptionalModules/Avatar/XmlRpcGroups | |
parent | minor: Remove unnecessary very old System.Net reference in OpenSim.Region.Scr... (diff) | |
download | opensim-SC-80c19b7cac52a57fd04966169c657400aeee3de8.zip opensim-SC-80c19b7cac52a57fd04966169c657400aeee3de8.tar.gz opensim-SC-80c19b7cac52a57fd04966169c657400aeee3de8.tar.bz2 opensim-SC-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/OptionalModules/Avatar/XmlRpcGroups')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 1101851..71b24ac 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -1146,28 +1146,38 @@ namespace Nwc.XmlRpc | |||
1146 | request.AllowWriteStreamBuffering = true; | 1146 | request.AllowWriteStreamBuffering = true; |
1147 | request.KeepAlive = !_disableKeepAlive; | 1147 | request.KeepAlive = !_disableKeepAlive; |
1148 | 1148 | ||
1149 | Stream stream = request.GetRequestStream(); | 1149 | using (Stream stream = request.GetRequestStream()) |
1150 | XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII); | ||
1151 | _serializer.Serialize(xml, this); | ||
1152 | xml.Flush(); | ||
1153 | xml.Close(); | ||
1154 | |||
1155 | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | ||
1156 | StreamReader input = new StreamReader(response.GetResponseStream()); | ||
1157 | |||
1158 | string inputXml = input.ReadToEnd(); | ||
1159 | XmlRpcResponse resp; | ||
1160 | try | ||
1161 | { | 1150 | { |
1162 | resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); | 1151 | using (XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII)) |
1152 | { | ||
1153 | _serializer.Serialize(xml, this); | ||
1154 | xml.Flush(); | ||
1155 | } | ||
1163 | } | 1156 | } |
1164 | catch (Exception e) | 1157 | |
1158 | XmlRpcResponse resp; | ||
1159 | |||
1160 | using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) | ||
1165 | { | 1161 | { |
1166 | RequestResponse = inputXml; | 1162 | using (Stream s = response.GetResponseStream()) |
1167 | throw e; | 1163 | { |
1164 | using (StreamReader input = new StreamReader(s)) | ||
1165 | { | ||
1166 | string inputXml = input.ReadToEnd(); | ||
1167 | |||
1168 | try | ||
1169 | { | ||
1170 | resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); | ||
1171 | } | ||
1172 | catch (Exception e) | ||
1173 | { | ||
1174 | RequestResponse = inputXml; | ||
1175 | throw e; | ||
1176 | } | ||
1177 | } | ||
1178 | } | ||
1168 | } | 1179 | } |
1169 | input.Close(); | 1180 | |
1170 | response.Close(); | ||
1171 | return resp; | 1181 | return resp; |
1172 | } | 1182 | } |
1173 | } | 1183 | } |