aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/Voice
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/Region/OptionalModules/Avatar/Voice
parentminor: Remove unnecessary very old System.Net reference in OpenSim.Region.Scr... (diff)
downloadopensim-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/Voice')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs21
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs12
2 files changed, 19 insertions, 14 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 37ab35a..ef1b92e 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -551,13 +551,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
551 reqStream.Close(); 551 reqStream.Close();
552 } 552 }
553 553
554 HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse(); 554 using (HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse())
555 Encoding encoding = Util.UTF8; 555 {
556 StreamReader fwdresponsestream = new StreamReader(fwdrsp.GetResponseStream(), encoding); 556 Encoding encoding = Util.UTF8;
557 fwdresponsestr = fwdresponsestream.ReadToEnd(); 557
558 fwdresponsecontenttype = fwdrsp.ContentType; 558 using (Stream s = fwdrsp.GetResponseStream())
559 fwdresponsecode = (int)fwdrsp.StatusCode; 559 {
560 fwdresponsestream.Close(); 560 using (StreamReader fwdresponsestream = new StreamReader(s))
561 {
562 fwdresponsestr = fwdresponsestream.ReadToEnd();
563 fwdresponsecontenttype = fwdrsp.ContentType;
564 fwdresponsecode = (int)fwdrsp.StatusCode;
565 }
566 }
567 }
561 568
562 response["content_type"] = fwdresponsecontenttype; 569 response["content_type"] = fwdresponsecontenttype;
563 response["str_response_string"] = fwdresponsestr; 570 response["str_response_string"] = fwdresponsestr;
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
index 881807a..cb69411 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
@@ -1116,18 +1116,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1116 // Otherwise prepare the request 1116 // Otherwise prepare the request
1117 m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl); 1117 m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl);
1118 1118
1119 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); 1119 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl);
1120 HttpWebResponse rsp = null;
1121 1120
1122 // We are sending just parameters, no content 1121 // We are sending just parameters, no content
1123 req.ContentLength = 0; 1122 req.ContentLength = 0;
1124 1123
1125 // Send request and retrieve the response 1124 // Send request and retrieve the response
1126 rsp = (HttpWebResponse)req.GetResponse(); 1125 using (HttpWebResponse rsp = (HttpWebResponse)req.GetResponse())
1127 1126 using (Stream s = rsp.GetResponseStream())
1128 XmlTextReader rdr = new XmlTextReader(rsp.GetResponseStream()); 1127 using (XmlTextReader rdr = new XmlTextReader(s))
1129 doc.Load(rdr); 1128 doc.Load(rdr);
1130 rdr.Close();
1131 } 1129 }
1132 catch (Exception e) 1130 catch (Exception e)
1133 { 1131 {