From 4843edfeb7a4af37125c9916350e5cd1a2e2ba7c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 3 Oct 2009 08:33:19 -0700 Subject: Closing more streams. --- .../HttpServer/SynchronousRestFormsRequester.cs | 31 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index a0d4008..85622a1 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -66,8 +66,20 @@ namespace OpenSim.Framework.Servers.HttpServer length = (int)obj.Length; request.ContentLength = length; - Stream requestStream = request.GetRequestStream(); - requestStream.Write(buffer.ToArray(), 0, length); + Stream requestStream = null; + try + { + requestStream = request.GetRequestStream(); + requestStream.Write(buffer.ToArray(), 0, length); + } + catch + { + } + finally + { + if (requestStream != null) + requestStream.Close(); + } } string respstring = String.Empty; @@ -78,9 +90,20 @@ namespace OpenSim.Framework.Servers.HttpServer { if (resp.ContentLength > 0) { - using (StreamReader reader = new StreamReader(resp.GetResponseStream())) + Stream respStream = null; + try + { + respStream = resp.GetResponseStream(); + using (StreamReader reader = new StreamReader(respStream)) + { + respstring = reader.ReadToEnd(); + } + } + catch { } + finally { - respstring = reader.ReadToEnd(); + if (respStream != null) + respStream.Close(); } } } -- cgit v1.1 From df7049008acd394fa514db584f56d0e3925a2d77 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 3 Oct 2009 08:57:30 -0700 Subject: More streams closed. --- OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index 85622a1..e76d80e 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -62,6 +62,7 @@ namespace OpenSim.Framework.Servers.HttpServer writer.Write(obj); writer.Flush(); } + buffer.Close(); length = (int)obj.Length; request.ContentLength = length; -- cgit v1.1 From b6920267f0e286a78f792c844ff30021044d7e9b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 3 Oct 2009 16:27:55 -0700 Subject: Close was being called to early on the Memory stream. --- OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index e76d80e..11df103 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -62,7 +62,6 @@ namespace OpenSim.Framework.Servers.HttpServer writer.Write(obj); writer.Flush(); } - buffer.Close(); length = (int)obj.Length; request.ContentLength = length; @@ -80,6 +79,8 @@ namespace OpenSim.Framework.Servers.HttpServer { if (requestStream != null) requestStream.Close(); + buffer.Close(); + } } -- cgit v1.1 From f21f3727df3ec76a3f65cf6b889c48ff1326086e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 4 Oct 2009 09:20:01 -0700 Subject: Leaving the MemoryStreams unclosed. --- OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index 11df103..8a490f7 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -79,7 +79,8 @@ namespace OpenSim.Framework.Servers.HttpServer { if (requestStream != null) requestStream.Close(); - buffer.Close(); + // Let's not close this + //buffer.Close(); } } -- cgit v1.1