Commit 74667819 authored by justcoding121's avatar justcoding121 Committed by justcoding121

revert experimental changes

parent c274e177
......@@ -58,7 +58,19 @@ namespace Titanium.Web.Proxy.Network.Tcp
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
client.ReceiveTimeout = server.ConnectionTimeOutSeconds * 1000;
client.SendTimeout = server.ConnectionTimeOutSeconds * 1000;
client.LingerState = new LingerOption(true, 0);
Interlocked.Increment(ref server.ServerConnectionCountField);
return new TcpConnection
......
......@@ -600,12 +600,6 @@ namespace Titanium.Web.Proxy
{
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
{
if (endPoint.GetType() == typeof(TransparentProxyEndPoint))
......@@ -620,7 +614,20 @@ namespace Titanium.Web.Proxy
finally
{
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