Commit 32a55f2c authored by Honfika's avatar Honfika

dispose flag changed to disposed flag in HandleHttpSessionRequestInternal

parent e68cc842
...@@ -261,7 +261,8 @@ namespace Titanium.Web.Proxy ...@@ -261,7 +261,8 @@ namespace Titanium.Web.Proxy
private async Task<bool> HandleHttpSessionRequestInternal(TcpConnection connection, SessionEventArgs args, bool closeConnection) private async Task<bool> HandleHttpSessionRequestInternal(TcpConnection connection, SessionEventArgs args, bool closeConnection)
{ {
bool dispose = true; bool disposed = false;
bool keepAlive = false;
try try
{ {
...@@ -334,12 +335,11 @@ namespace Titanium.Web.Proxy ...@@ -334,12 +335,11 @@ namespace Titanium.Web.Proxy
//If not expectation failed response was returned by server then parse response //If not expectation failed response was returned by server then parse response
if (!args.WebSession.Request.ExpectationFailed) if (!args.WebSession.Request.ExpectationFailed)
{ {
var disposed = await HandleHttpSessionResponse(args); disposed = await HandleHttpSessionResponse(args);
//already disposed inside above method //already disposed inside above method
if (disposed) if (disposed)
{ {
dispose = false;
return true; return true;
} }
} }
...@@ -352,7 +352,7 @@ namespace Titanium.Web.Proxy ...@@ -352,7 +352,7 @@ namespace Titanium.Web.Proxy
if (!closeConnection) if (!closeConnection)
{ {
dispose = false; keepAlive = true;
return false; return false;
} }
} }
...@@ -363,7 +363,7 @@ namespace Titanium.Web.Proxy ...@@ -363,7 +363,7 @@ namespace Titanium.Web.Proxy
} }
finally finally
{ {
if (dispose) if (!disposed && !keepAlive)
{ {
//dispose //dispose
Dispose(args.ProxyClient.ClientStream, args.ProxyClient.ClientStreamReader, args.ProxyClient.ClientStreamWriter, args.WebSession.ServerConnection); Dispose(args.ProxyClient.ClientStream, args.ProxyClient.ClientStreamReader, args.ProxyClient.ClientStreamWriter, args.WebSession.ServerConnection);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment