Close streams immediately when we finish using them

This commit is contained in:
Oren Hurvitz
2014-06-01 17:39:11 +03:00
parent b81187db5a
commit 99ac770abb
34 changed files with 426 additions and 485 deletions

View File

@@ -373,24 +373,27 @@ namespace OpenSim.Region.DataSnapshot
for (int i = 0; i < services.Length; i++)
{
string url = services[i].Trim();
RestClient cli = new RestClient(url);
cli.AddQueryParameter("service", serviceName);
cli.AddQueryParameter("host", m_hostname);
cli.AddQueryParameter("port", m_listener_port);
cli.AddQueryParameter("secret", m_Secret.ToString());
cli.RequestMethod = "GET";
try
using (RestClient cli = new RestClient(url))
{
reply = cli.Request(null);
}
catch (WebException)
{
m_log.Warn("[DATASNAPSHOT]: Unable to notify " + url);
}
catch (Exception e)
{
m_log.Warn("[DATASNAPSHOT]: Ignoring unknown exception " + e.ToString());
cli.AddQueryParameter("service", serviceName);
cli.AddQueryParameter("host", m_hostname);
cli.AddQueryParameter("port", m_listener_port);
cli.AddQueryParameter("secret", m_Secret.ToString());
cli.RequestMethod = "GET";
try
{
reply = cli.Request(null);
}
catch (WebException)
{
m_log.Warn("[DATASNAPSHOT]: Unable to notify " + url);
}
catch (Exception e)
{
m_log.Warn("[DATASNAPSHOT]: Ignoring unknown exception " + e.ToString());
}
}
byte[] response = new byte[1024];
// int n = 0;
try