Commit b1aea826 authored by justcoding121's avatar justcoding121

#466 disable socket reuse for linux

parent 51a8e576
...@@ -23,6 +23,9 @@ namespace Titanium.Web.Proxy.Helpers ...@@ -23,6 +23,9 @@ namespace Titanium.Web.Proxy.Helpers
/// <returns></returns> /// <returns></returns>
private static readonly Lazy<bool> isRunningOnWindows private static readonly Lazy<bool> isRunningOnWindows
= new Lazy<bool>(() => RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); = new Lazy<bool>(() => RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
private static readonly Lazy<bool> isRunningOnLinux
= new Lazy<bool>(() => RuntimeInformation.IsOSPlatform(OSPlatform.Linux));
#endif #endif
/// <summary> /// <summary>
...@@ -30,6 +33,12 @@ private static readonly Lazy<bool> isRunningOnWindows ...@@ -30,6 +33,12 @@ private static readonly Lazy<bool> isRunningOnWindows
/// </summary> /// </summary>
internal static bool IsRunningOnMono => isRunningOnMono.Value; internal static bool IsRunningOnMono => isRunningOnMono.Value;
#if NETSTANDARD2_0
internal static bool IsLinux => isRunningOnLinux.Value;
#else
internal static bool IsLinux => !IsWindows;
#endif
#if NETSTANDARD2_0 #if NETSTANDARD2_0
internal static bool IsWindows => isRunningOnWindows.Value; internal static bool IsWindows => isRunningOnWindows.Value;
#else #else
......
...@@ -109,6 +109,12 @@ namespace Titanium.Web.Proxy ...@@ -109,6 +109,12 @@ namespace Titanium.Web.Proxy
systemProxySettingsManager = new SystemProxyManager(); systemProxySettingsManager = new SystemProxyManager();
} }
//linux have bug with socket reuse
if (!RunTime.IsLinux)
{
ReuseSocket = true;
}
CertificateManager = new CertificateManager(rootCertificateName, rootCertificateIssuerName, CertificateManager = new CertificateManager(rootCertificateName, rootCertificateIssuerName,
userTrustRootCertificate, machineTrustRootCertificate, trustRootCertificateAsAdmin, ExceptionFunc); userTrustRootCertificate, machineTrustRootCertificate, trustRootCertificateAsAdmin, ExceptionFunc);
} }
...@@ -194,9 +200,9 @@ namespace Titanium.Web.Proxy ...@@ -194,9 +200,9 @@ namespace Titanium.Web.Proxy
/// <summary> /// <summary>
/// Should we resues client/server tcp sockets. /// Should we resues client/server tcp sockets.
/// Default is true. /// Default is true (false for linux due to bug in .Net core).
/// </summary> /// </summary>
public bool ReuseSocket { get; set; } = true; public bool ReuseSocket { get; set; }
/// <summary> /// <summary>
/// Total number of active client connections. /// Total number of active client connections.
......
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