Commit 124443c5 authored by justcoding121's avatar justcoding121

cleanup

parent 36f8342f
...@@ -732,13 +732,19 @@ namespace Titanium.Web.Proxy ...@@ -732,13 +732,19 @@ namespace Titanium.Web.Proxy
if (tcpClient != null) if (tcpClient != null)
{ {
SetThreadPoolMinThread(1); // increase the ThreadPool setThreadPoolMinThread(1); // increase the ThreadPool
Task.Run(async () => Task.Run(async () =>
{
try
{ {
await handleClient(tcpClient, endPoint); await handleClient(tcpClient, endPoint);
}
finally
{
setThreadPoolMinThread(-1); //decrease the Threadpool
}
SetThreadPoolMinThread(-1); //decrease the Threadpool
}); });
} }
...@@ -750,7 +756,7 @@ namespace Titanium.Web.Proxy ...@@ -750,7 +756,7 @@ namespace Titanium.Web.Proxy
/// Change the ThreadPool.WorkerThread minThread /// Change the ThreadPool.WorkerThread minThread
/// </summary> /// </summary>
/// <param name="piNbWorkerThreadsToAdd">Number of threads to add</param> /// <param name="piNbWorkerThreadsToAdd">Number of threads to add</param>
void SetThreadPoolMinThread(int piNbWorkerThreadsToAdd) private void setThreadPoolMinThread(int piNbWorkerThreadsToAdd)
{ {
if (EnableThreadPoolOptimizing) if (EnableThreadPoolOptimizing)
{ {
...@@ -774,8 +780,7 @@ namespace Titanium.Web.Proxy ...@@ -774,8 +780,7 @@ namespace Titanium.Web.Proxy
{ {
tcpClient.ReceiveTimeout = ConnectionTimeOutSeconds * 1000; tcpClient.ReceiveTimeout = ConnectionTimeOutSeconds * 1000;
tcpClient.SendTimeout = ConnectionTimeOutSeconds * 1000; tcpClient.SendTimeout = ConnectionTimeOutSeconds * 1000;
tcpClient.SendBufferSize = BufferSize;
tcpClient.ReceiveBufferSize = BufferSize;
tcpClient.LingerState = new LingerOption(true, TcpTimeWaitSeconds); tcpClient.LingerState = new LingerOption(true, TcpTimeWaitSeconds);
await InvokeConnectionCreateEvent(tcpClient, true); await InvokeConnectionCreateEvent(tcpClient, true);
......
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