Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

Commit

Permalink
Increase default cache connection count
Browse files Browse the repository at this point in the history
  • Loading branch information
justcoding121 committed Aug 16, 2021
1 parent 8ce56f7 commit d56086d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Titanium.Web.Proxy/ProxyServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ public ProxyServer(string? rootCertificateName, string? rootCertificateIssuerNam
/// <summary>
/// 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.
/// </summary>
public int MaxCachedConnections { get; set; } = 2;
public int MaxCachedConnections { get; set; } = 4;

/// <summary>
/// Number of seconds to linger when Tcp connection is in TIME_WAIT state.
Expand Down
7 changes: 3 additions & 4 deletions tests/Titanium.Web.Proxy.IntegrationTests/NestedProxyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,14 @@ public async Task Nested_Proxy_Farm_With_Connection_Cache_Should_Not_Hang()
var proxies2 = new List<ProxyServer>();

//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);
}

Expand All @@ -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<ExplicitProxyEndPoint>().First();
explicitEndpoint.BeforeTunnelConnectRequest += (_, e) =>
{
Expand Down

0 comments on commit d56086d

Please sign in to comment.