From d56086deeb37ec019af021235f6f0ff0df4e57bf Mon Sep 17 00:00:00 2001 From: justcoding121 Date: Mon, 16 Aug 2021 00:30:07 -0600 Subject: [PATCH] Increase default cache connection count --- src/Titanium.Web.Proxy/ProxyServer.cs | 4 ++-- .../NestedProxyTests.cs | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Titanium.Web.Proxy/ProxyServer.cs b/src/Titanium.Web.Proxy/ProxyServer.cs index 377e31d6a..938691a04 100644 --- a/src/Titanium.Web.Proxy/ProxyServer.cs +++ b/src/Titanium.Web.Proxy/ProxyServer.cs @@ -208,9 +208,9 @@ public ProxyServer(string? rootCertificateName, string? rootCertificateIssuerNam /// /// Maximum number of concurrent connections per remote host in cache. /// Only valid when connection pooling is enabled. - /// Default value is 2. + /// Default value is 4. /// - public int MaxCachedConnections { get; set; } = 2; + public int MaxCachedConnections { get; set; } = 4; /// /// Number of seconds to linger when Tcp connection is in TIME_WAIT state. diff --git a/tests/Titanium.Web.Proxy.IntegrationTests/NestedProxyTests.cs b/tests/Titanium.Web.Proxy.IntegrationTests/NestedProxyTests.cs index 84d23eadc..49d7aa3f9 100644 --- a/tests/Titanium.Web.Proxy.IntegrationTests/NestedProxyTests.cs +++ b/tests/Titanium.Web.Proxy.IntegrationTests/NestedProxyTests.cs @@ -195,14 +195,14 @@ public async Task Nested_Proxy_Farm_With_Connection_Cache_Should_Not_Hang() var proxies2 = new List(); //create a level 2 upstream proxy farm that forwards to server - for (int i = 0; i < 10; i++) + for (int i = 0; i < 2; i++) { var proxy2 = testSuite.GetProxy(); proxy2.ProxyBasicAuthenticateFunc += (_, _, _) => { return Task.FromResult(true); }; - + proxy2.MaxCachedConnections = 100; proxies2.Add(proxy2); } @@ -212,9 +212,8 @@ public async Task Nested_Proxy_Farm_With_Connection_Cache_Should_Not_Hang() for (int i = 0; i < 10; i++) { var proxy1 = testSuite.GetProxy(); - //proxy1.EnableConnectionPool = false; var proxy2 = proxies2[rnd.Next() % proxies2.Count]; - + proxy1.MaxCachedConnections = 100; var explicitEndpoint = proxy1.ProxyEndPoints.OfType().First(); explicitEndpoint.BeforeTunnelConnectRequest += (_, e) => {