More streams closed.

prioritization
Diva Canto 2009-10-03 08:57:30 -07:00
parent de94aa9bb5
commit df7049008a
2 changed files with 18 additions and 2 deletions

View File

@ -88,6 +88,7 @@ namespace OpenSim.Framework.Servers.HttpServer
serializer.Serialize(writer, sobj);
writer.Flush();
}
buffer.Close();
int length = (int)buffer.Length;
request.ContentLength = length;
@ -99,9 +100,20 @@ namespace OpenSim.Framework.Servers.HttpServer
using (WebResponse resp = request.GetResponse())
{
XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream());
Stream respStream = null;
try
{
respStream = resp.GetResponseStream();
deserial = (TResponse)deserializer.Deserialize(respStream);
}
catch { }
finally
{
if (respStream != null)
respStream.Close();
resp.Close();
}
}
return deserial;
}
}
@ -140,6 +152,7 @@ namespace OpenSim.Framework.Servers.HttpServer
serializer.Serialize(writer, sobj);
writer.Flush();
}
buffer.Close();
int length = (int)buffer.Length;
request.ContentLength = length;
@ -165,6 +178,8 @@ namespace OpenSim.Framework.Servers.HttpServer
// m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd());
deserial = (TResponse)deserializer.Deserialize(stream);
if (stream != null)
stream.Close();
if (deserial != null && ResponseCallback != null)
{

View File

@ -62,6 +62,7 @@ namespace OpenSim.Framework.Servers.HttpServer
writer.Write(obj);
writer.Flush();
}
buffer.Close();
length = (int)obj.Length;
request.ContentLength = length;