Close streams in MakeRequest.
parent
3ba36bb4d8
commit
e66321227e
|
@ -91,19 +91,26 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
Stream requestStream = request.EndGetRequestStream(res);
|
Stream requestStream = request.EndGetRequestStream(res);
|
||||||
|
|
||||||
requestStream.Write(buffer.ToArray(), 0, length);
|
requestStream.Write(buffer.ToArray(), 0, length);
|
||||||
|
requestStream.Close();
|
||||||
|
|
||||||
request.BeginGetResponse(delegate(IAsyncResult ar)
|
request.BeginGetResponse(delegate(IAsyncResult ar)
|
||||||
{
|
{
|
||||||
response = request.EndGetResponse(ar);
|
response = request.EndGetResponse(ar);
|
||||||
|
Stream respStream = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
deserial = (TResponse) deserializer.Deserialize(
|
respStream = response.GetResponseStream();
|
||||||
response.GetResponseStream());
|
deserial = (TResponse)deserializer.Deserialize(
|
||||||
|
respStream);
|
||||||
}
|
}
|
||||||
catch (System.InvalidOperationException)
|
catch (System.InvalidOperationException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
respStream.Close();
|
||||||
|
response.Close();
|
||||||
|
}
|
||||||
|
|
||||||
action(deserial);
|
action(deserial);
|
||||||
}, null);
|
}, null);
|
||||||
|
@ -120,13 +127,20 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
// documented in MSDN
|
// documented in MSDN
|
||||||
response = request.EndGetResponse(res2);
|
response = request.EndGetResponse(res2);
|
||||||
|
|
||||||
|
Stream respStream = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
deserial = (TResponse)deserializer.Deserialize(response.GetResponseStream());
|
respStream = response.GetResponseStream();
|
||||||
|
deserial = (TResponse)deserializer.Deserialize(respStream);
|
||||||
}
|
}
|
||||||
catch (System.InvalidOperationException)
|
catch (System.InvalidOperationException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
respStream.Close();
|
||||||
|
response.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (WebException e)
|
catch (WebException e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue