Commit 6c15f3c7 authored by justcoding121's avatar justcoding121

revert experimental changes

parent bf4921a0
...@@ -58,7 +58,19 @@ namespace Titanium.Web.Proxy.Network.Tcp ...@@ -58,7 +58,19 @@ namespace Titanium.Web.Proxy.Network.Tcp
StreamReader?.Dispose(); StreamReader?.Dispose();
TcpClient?.Close(); try
{
if (TcpClient != null)
{
//This line is important!
//contributors please don't remove it without discussion
//It helps to avoid eventual deterioration of performance due to TCP port exhaustion
//due to default TCP CLOSE_WAIT timeout for 4 minutes
TcpClient.LingerState = new LingerOption(true, 0);
TcpClient.Close();
}
}
catch { }
} }
} }
} }
...@@ -125,8 +125,6 @@ namespace Titanium.Web.Proxy.Network.Tcp ...@@ -125,8 +125,6 @@ namespace Titanium.Web.Proxy.Network.Tcp
client.ReceiveTimeout = server.ConnectionTimeOutSeconds * 1000; client.ReceiveTimeout = server.ConnectionTimeOutSeconds * 1000;
client.SendTimeout = server.ConnectionTimeOutSeconds * 1000; client.SendTimeout = server.ConnectionTimeOutSeconds * 1000;
client.LingerState = new LingerOption(true, 0);
Interlocked.Increment(ref server.ServerConnectionCountField); Interlocked.Increment(ref server.ServerConnectionCountField);
return new TcpConnection return new TcpConnection
......
...@@ -600,12 +600,6 @@ namespace Titanium.Web.Proxy ...@@ -600,12 +600,6 @@ namespace Titanium.Web.Proxy
{ {
Interlocked.Increment(ref clientConnectionCountField); Interlocked.Increment(ref clientConnectionCountField);
//This line is important!
//contributors please don't remove it without discussion
//It helps to avoid eventual deterioration of performance due to TCP port exhaustion
//due to default TCP CLOSE_WAIT timeout for 4 minutes
tcpClient.LingerState = new LingerOption(true, 0);
try try
{ {
if (endPoint.GetType() == typeof(TransparentProxyEndPoint)) if (endPoint.GetType() == typeof(TransparentProxyEndPoint))
...@@ -620,7 +614,20 @@ namespace Titanium.Web.Proxy ...@@ -620,7 +614,20 @@ namespace Titanium.Web.Proxy
finally finally
{ {
Interlocked.Decrement(ref clientConnectionCountField); Interlocked.Decrement(ref clientConnectionCountField);
tcpClient?.Close();
try
{
if (tcpClient != null)
{
//This line is important!
//contributors please don't remove it without discussion
//It helps to avoid eventual deterioration of performance due to TCP port exhaustion
//due to default TCP CLOSE_WAIT timeout for 4 minutes
tcpClient.LingerState = new LingerOption(true, 0);
tcpClient.Close();
}
}
catch { }
} }
}); });
} }
......
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