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

Commit 20c22dd

Browse files
authored
Update TcpConnectionFactory.cs
enable socket based on framework version via RunTime.IsSocketReuseAvailable
1 parent c007cb6 commit 20c22dd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,7 @@ private async Task<TcpServerConnection> createServerConnection(string remoteHost
315315
tcpClient.SendTimeout = proxyServer.ConnectionTimeOutSeconds * 1000;
316316
tcpClient.LingerState = new LingerOption(true, proxyServer.TcpTimeWaitSeconds);
317317

318-
// linux has a bug with socket reuse in .net core.
319-
if (proxyServer.ReuseSocket && RunTime.IsWindows)
318+
if (proxyServer.ReuseSocket && RunTime.IsSocketReuseAvailable)
320319
{
321320
tcpClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
322321
}

0 commit comments

Comments
 (0)