Commit 575d14ac authored by justcoding121's avatar justcoding121

disable socket reuse in linux/macOS

parent 81feeb2b
...@@ -277,7 +277,7 @@ namespace Titanium.Web.Proxy.Network.Tcp ...@@ -277,7 +277,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
}; };
//linux has a bug with socket reuse in .net core. //linux has a bug with socket reuse in .net core.
if (proxyServer.ReuseSocket && !RunTime.IsLinux) if (proxyServer.ReuseSocket && RunTime.IsWindows || RunTime.IsRunningOnMono)
{ {
tcpClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); tcpClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
} }
......
...@@ -193,7 +193,7 @@ namespace Titanium.Web.Proxy ...@@ -193,7 +193,7 @@ namespace Titanium.Web.Proxy
/// <summary> /// <summary>
/// Should we reuse client/server tcp sockets. /// Should we reuse client/server tcp sockets.
/// Default is true (false for linux due to bug in .Net core). /// Default is true (disabled for linux/macOS due to bug in .Net core).
/// </summary> /// </summary>
public bool ReuseSocket { get; set; } = true; public bool ReuseSocket { get; set; } = true;
...@@ -617,8 +617,8 @@ namespace Titanium.Web.Proxy ...@@ -617,8 +617,8 @@ namespace Titanium.Web.Proxy
{ {
endPoint.Listener = new TcpListener(endPoint.IpAddress, endPoint.Port); endPoint.Listener = new TcpListener(endPoint.IpAddress, endPoint.Port);
//linux has a bug with socket reuse in .net core. //linux/macOS has a bug with socket reuse in .net core.
if (ReuseSocket && !RunTime.IsLinux) if (ReuseSocket && (RunTime.IsWindows || RunTime.IsRunningOnMono))
{ {
endPoint.Listener.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); endPoint.Listener.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 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