From 31033aa375ac74ff01d65588f73c14679a894de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graziano?= Date: Fri, 12 Apr 2019 15:19:07 +0200 Subject: [PATCH 1/2] Example for ThreadWorkerThread use --- examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs b/examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs index 6bc523859..dea71368d 100644 --- a/examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs +++ b/examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs @@ -53,6 +53,9 @@ public MainWindow() proxyServer.ForwardToUpstreamGateway = true; + //increase the ThreadPool (for server prod) + //proxyServer.ThreadPoolWorkerThread = Environment.ProcessorCount * 6; + ////if you need Load or Create Certificate now. ////// "true" if you need Enable===> Trust the RootCertificate used by this proxy server //proxyServer.CertificateManager.EnsureRootCertificate(true); From 1fcd683896840eaf961956d13b44919113b79050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graziano?= Date: Thu, 18 Apr 2019 17:38:31 +0200 Subject: [PATCH 2/2] Preivous code with "continue" generates a memory leak on 'connection' for an unknown reason. In any case, this code is easier to read. --- .../Network/Tcp/TcpConnectionFactory.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs b/src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs index 2f726bf21..04d68deee 100644 --- a/src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs +++ b/src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs @@ -494,11 +494,12 @@ private async Task clearOutdatedConnections() || connection.LastAccess < cutOff) { disposalBag.Add(connection); - continue; } - - queue.Enqueue(connection); - break; + else + { + queue.Enqueue(connection); + break; + } } } }