Commit 75db454c authored by justcoding121's avatar justcoding121

fix object reference null error

parent 70635fde
...@@ -44,23 +44,19 @@ namespace Titanium.Web.Proxy.Network ...@@ -44,23 +44,19 @@ namespace Titanium.Web.Proxy.Network
@continue = await action(currentConnection); @continue = await action(currentConnection);
} }
catch (T ex) catch (Exception ex)
{ {
await disposeConnection();
exception = ex; exception = ex;
} }
catch
{
await disposeConnection();
throw;
}
if(exception == null) if(exception == null
|| !(exception is T))
{ {
break; break;
} }
exception = null; exception = null;
await disposeConnection();
attempts--; attempts--;
} }
......
...@@ -267,7 +267,8 @@ namespace Titanium.Web.Proxy ...@@ -267,7 +267,8 @@ namespace Titanium.Web.Proxy
//between sessions without using it. //between sessions without using it.
//Do not release authenticated connections for performance reasons. //Do not release authenticated connections for performance reasons.
//Otherwise it will keep authenticating per session. //Otherwise it will keep authenticating per session.
if (EnableConnectionPool && !connection.IsWinAuthenticated) if (EnableConnectionPool && connection!=null
&& !connection.IsWinAuthenticated)
{ {
await tcpConnectionFactory.Release(connection); await tcpConnectionFactory.Release(connection);
connection = null; connection = null;
......
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