Commit 0ec5a023 authored by justcoding121's avatar justcoding121

rename

parent 6eb3a4f9
...@@ -177,7 +177,7 @@ namespace Titanium.Web.Proxy ...@@ -177,7 +177,7 @@ namespace Titanium.Web.Proxy
continue; continue;
} }
bool connectionChanged = false; bool newConnection = false;
// create a new connection if hostname/upstream end point changes // create a new connection if hostname/upstream end point changes
if (serverConnection != null if (serverConnection != null
&& (!serverConnection.HostName.EqualsIgnoreCase(request.RequestUri.Host) && (!serverConnection.HostName.EqualsIgnoreCase(request.RequestUri.Host)
...@@ -186,14 +186,14 @@ namespace Titanium.Web.Proxy ...@@ -186,14 +186,14 @@ namespace Titanium.Web.Proxy
{ {
await tcpConnectionFactory.Release(serverConnection, true); await tcpConnectionFactory.Release(serverConnection, true);
serverConnection = null; serverConnection = null;
connectionChanged = true; newConnection = true;
} }
if (serverConnection == null) if (serverConnection == null)
{ {
serverConnection = await getServerConnection(args, false, serverConnection = await getServerConnection(args, false,
clientConnection.NegotiatedApplicationProtocol, cancellationToken); clientConnection.NegotiatedApplicationProtocol, cancellationToken);
connectionChanged = true; newConnection = true;
} }
//for connection pool retry fails until cache is exhausted //for connection pool retry fails until cache is exhausted
...@@ -220,7 +220,8 @@ namespace Titanium.Web.Proxy ...@@ -220,7 +220,8 @@ namespace Titanium.Web.Proxy
//connection pool retry //connection pool retry
catch (ServerConnectionException) catch (ServerConnectionException)
{ {
if (!connectionChanged || !EnableConnectionPool || attempt == MaxCachedConnections + 1) attempt++;
if (!newConnection || !EnableConnectionPool || attempt == MaxCachedConnections + 1)
{ {
throw; throw;
} }
...@@ -229,7 +230,7 @@ namespace Titanium.Web.Proxy ...@@ -229,7 +230,7 @@ namespace Titanium.Web.Proxy
await tcpConnectionFactory.Release(serverConnection, true); await tcpConnectionFactory.Release(serverConnection, true);
serverConnection = await getServerConnection(args, false, serverConnection = await getServerConnection(args, false,
clientConnection.NegotiatedApplicationProtocol, cancellationToken); clientConnection.NegotiatedApplicationProtocol, cancellationToken);
attempt++;
continue; continue;
} }
......
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