Make sure Web streams are disposed after use
parent
1380b37d71
commit
b8e22f02e7
|
@ -1030,7 +1030,7 @@ namespace OpenSim.Framework
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (requestStream != null)
|
if (requestStream != null)
|
||||||
requestStream.Close();
|
requestStream.Dispose();
|
||||||
|
|
||||||
// capture how much time was spent writing
|
// capture how much time was spent writing
|
||||||
tickdata = Util.EnvironmentTickCountSubtract(tickstart);
|
tickdata = Util.EnvironmentTickCountSubtract(tickstart);
|
||||||
|
@ -1183,7 +1183,7 @@ namespace OpenSim.Framework
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (requestStream != null)
|
if (requestStream != null)
|
||||||
requestStream.Close();
|
requestStream.Dispose();
|
||||||
|
|
||||||
// capture how much time was spent writing
|
// capture how much time was spent writing
|
||||||
tickdata = Util.EnvironmentTickCountSubtract(tickstart);
|
tickdata = Util.EnvironmentTickCountSubtract(tickstart);
|
||||||
|
|
|
@ -1290,9 +1290,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
|
||||||
webRequest.ContentType = "application/json-rpc";
|
webRequest.ContentType = "application/json-rpc";
|
||||||
webRequest.Method = "POST";
|
webRequest.Method = "POST";
|
||||||
|
|
||||||
Stream dataStream = webRequest.GetRequestStream();
|
using (Stream dataStream = webRequest.GetRequestStream())
|
||||||
dataStream.Write(content, 0, content.Length);
|
dataStream.Write(content, 0, content.Length);
|
||||||
dataStream.Close();
|
|
||||||
|
|
||||||
WebResponse webResponse = null;
|
WebResponse webResponse = null;
|
||||||
try
|
try
|
||||||
|
@ -1306,27 +1305,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream rstream = webResponse.GetResponseStream();
|
using (webResponse)
|
||||||
|
using (Stream rstream = webResponse.GetResponseStream())
|
||||||
OSDMap mret = new OSDMap();
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
mret = (OSDMap)OSDParser.DeserializeJson(rstream);
|
OSDMap mret = (OSDMap)OSDParser.DeserializeJson(rstream);
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (mret.ContainsKey("error"))
|
if (mret.ContainsKey("error"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// get params...
|
// get params...
|
||||||
OSD.DeserializeMembers(ref parameters, (OSDMap) mret["result"]);
|
OSD.DeserializeMembers(ref parameters, (OSDMap)mret["result"]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends json-rpc request with OSD parameter.
|
/// Sends json-rpc request with OSD parameter.
|
||||||
|
@ -1366,9 +1357,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
|
||||||
webRequest.ContentType = "application/json-rpc";
|
webRequest.ContentType = "application/json-rpc";
|
||||||
webRequest.Method = "POST";
|
webRequest.Method = "POST";
|
||||||
|
|
||||||
Stream dataStream = webRequest.GetRequestStream();
|
using (Stream dataStream = webRequest.GetRequestStream())
|
||||||
dataStream.Write(content, 0, content.Length);
|
dataStream.Write(content, 0, content.Length);
|
||||||
dataStream.Close();
|
|
||||||
|
|
||||||
WebResponse webResponse = null;
|
WebResponse webResponse = null;
|
||||||
try
|
try
|
||||||
|
@ -1382,8 +1372,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream rstream = webResponse.GetResponseStream();
|
using (webResponse)
|
||||||
|
using (Stream rstream = webResponse.GetResponseStream())
|
||||||
|
{
|
||||||
OSDMap response = new OSDMap();
|
OSDMap response = new OSDMap();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1395,7 +1386,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(response.ContainsKey("error"))
|
if (response.ContainsKey("error"))
|
||||||
{
|
{
|
||||||
data = response["error"];
|
data = response["error"];
|
||||||
return false;
|
return false;
|
||||||
|
@ -1405,6 +1396,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Web Util
|
#endregion Web Util
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -488,9 +488,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||||
byte[] data = Util.UTF8.GetBytes(OutboundBody);
|
byte[] data = Util.UTF8.GetBytes(OutboundBody);
|
||||||
|
|
||||||
Request.ContentLength = data.Length;
|
Request.ContentLength = data.Length;
|
||||||
Stream bstream = Request.GetRequestStream();
|
using (Stream bstream = Request.GetRequestStream())
|
||||||
bstream.Write(data, 0, data.Length);
|
bstream.Write(data, 0, data.Length);
|
||||||
bstream.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -915,7 +915,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (os != null)
|
if (os != null)
|
||||||
os.Close();
|
os.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
string response_mapItems_reply = null;
|
string response_mapItems_reply = null;
|
||||||
|
|
|
@ -301,7 +301,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (os != null)
|
if (os != null)
|
||||||
os.Close();
|
os.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ namespace OpenSim.Services.Connectors
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (os != null)
|
if (os != null)
|
||||||
os.Close();
|
os.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's wait for the response
|
// Let's wait for the response
|
||||||
|
|
Loading…
Reference in New Issue