aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-02-27 00:21:02 +0000
committerJustin Clark-Casey (justincc)2013-02-27 00:21:02 +0000
commit80c19b7cac52a57fd04966169c657400aeee3de8 (patch)
tree32c48c0d00da28ed091d8c6a671d43d1e9ab8bdb /OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
parentminor: Remove unnecessary very old System.Net reference in OpenSim.Region.Scr... (diff)
downloadopensim-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/Services/Connectors/Neighbour/NeighbourServicesConnector.cs')
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs34
1 files changed, 17 insertions, 17 deletions
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
index 7429293..5948380 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
@@ -168,22 +168,27 @@ namespace OpenSim.Services.Connectors
168 // Let's wait for the response 168 // Let's wait for the response
169 //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); 169 //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall");
170 170
171 StreamReader sr = null;
172 try 171 try
173 { 172 {
174 WebResponse webResponse = helloNeighbourRequest.GetResponse(); 173 using (WebResponse webResponse = helloNeighbourRequest.GetResponse())
175 if (webResponse == null)
176 { 174 {
177 m_log.DebugFormat( 175 if (webResponse == null)
178 "[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}", 176 {
179 thisRegion.RegionName, region.RegionName); 177 m_log.DebugFormat(
178 "[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}",
179 thisRegion.RegionName, region.RegionName);
180 }
181
182 using (Stream s = webResponse.GetResponseStream())
183 {
184 using (StreamReader sr = new StreamReader(s))
185 {
186 //reply = sr.ReadToEnd().Trim();
187 sr.ReadToEnd().Trim();
188 //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply);
189 }
190 }
180 } 191 }
181
182 sr = new StreamReader(webResponse.GetResponseStream());
183 //reply = sr.ReadToEnd().Trim();
184 sr.ReadToEnd().Trim();
185 //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply);
186
187 } 192 }
188 catch (Exception e) 193 catch (Exception e)
189 { 194 {
@@ -193,11 +198,6 @@ namespace OpenSim.Services.Connectors
193 198
194 return false; 199 return false;
195 } 200 }
196 finally
197 {
198 if (sr != null)
199 sr.Close();
200 }
201 201
202 return true; 202 return true;
203 } 203 }