From d06b8fd7a4c03a2f2cf0551e32bed804ce363f6c Mon Sep 17 00:00:00 2001 From: Adrian Codrington Date: Thu, 16 Nov 2023 09:53:00 +0800 Subject: [PATCH 1/3] Add possible fixes (commented out) --- source/Halibut/Transport/TcpClientExtensions.cs | 1 + source/Halibut/Transport/TcpConnectionFactory.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/source/Halibut/Transport/TcpClientExtensions.cs b/source/Halibut/Transport/TcpClientExtensions.cs index 47bcc596..b70655bc 100644 --- a/source/Halibut/Transport/TcpClientExtensions.cs +++ b/source/Halibut/Transport/TcpClientExtensions.cs @@ -41,6 +41,7 @@ void DisposeClient() { try { + //client.CloseImmediately(); ((IDisposable) client).Dispose(); } catch (SocketException) diff --git a/source/Halibut/Transport/TcpConnectionFactory.cs b/source/Halibut/Transport/TcpConnectionFactory.cs index 6994bfdd..f924931b 100644 --- a/source/Halibut/Transport/TcpConnectionFactory.cs +++ b/source/Halibut/Transport/TcpConnectionFactory.cs @@ -93,6 +93,7 @@ internal static TcpClient CreateTcpClientAsync(AddressFamily addressFamily, Hali { SendTimeout = (int)halibutTimeoutsAndLimits.TcpClientSendTimeout.TotalMilliseconds, ReceiveTimeout = (int)halibutTimeoutsAndLimits.TcpClientReceiveTimeout.TotalMilliseconds + //LingerState = new LingerOption(true, 0), }; if (client.Client.AddressFamily == AddressFamily.InterNetworkV6) From 3e3fbb05456a3dda6d0b067d1cb931f1225251c3 Mon Sep 17 00:00:00 2001 From: Adrian Codrington Date: Thu, 16 Nov 2023 09:54:51 +0800 Subject: [PATCH 2/3] Set LingerState --- source/Halibut/Transport/TcpConnectionFactory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Halibut/Transport/TcpConnectionFactory.cs b/source/Halibut/Transport/TcpConnectionFactory.cs index f924931b..861bb370 100644 --- a/source/Halibut/Transport/TcpConnectionFactory.cs +++ b/source/Halibut/Transport/TcpConnectionFactory.cs @@ -92,8 +92,8 @@ internal static TcpClient CreateTcpClientAsync(AddressFamily addressFamily, Hali var client = new TcpClient(addressFamily) { SendTimeout = (int)halibutTimeoutsAndLimits.TcpClientSendTimeout.TotalMilliseconds, - ReceiveTimeout = (int)halibutTimeoutsAndLimits.TcpClientReceiveTimeout.TotalMilliseconds - //LingerState = new LingerOption(true, 0), + ReceiveTimeout = (int)halibutTimeoutsAndLimits.TcpClientReceiveTimeout.TotalMilliseconds, + LingerState = new LingerOption(true, 0) }; if (client.Client.AddressFamily == AddressFamily.InterNetworkV6) From 91999e3b1f0878d732c408754853c3a50702e381 Mon Sep 17 00:00:00 2001 From: Adrian Codrington Date: Thu, 16 Nov 2023 17:10:26 +0800 Subject: [PATCH 3/3] CloseImmediately --- source/Halibut/Transport/TcpClientExtensions.cs | 2 +- source/Halibut/Transport/TcpConnectionFactory.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/source/Halibut/Transport/TcpClientExtensions.cs b/source/Halibut/Transport/TcpClientExtensions.cs index 7adfe9fa..c801af88 100644 --- a/source/Halibut/Transport/TcpClientExtensions.cs +++ b/source/Halibut/Transport/TcpClientExtensions.cs @@ -43,7 +43,7 @@ void DisposeClient() { try { - //client.CloseImmediately(); + client.CloseImmediately(); ((IDisposable) client).Dispose(); } catch (SocketException) diff --git a/source/Halibut/Transport/TcpConnectionFactory.cs b/source/Halibut/Transport/TcpConnectionFactory.cs index f79dbfe8..1d51c591 100644 --- a/source/Halibut/Transport/TcpConnectionFactory.cs +++ b/source/Halibut/Transport/TcpConnectionFactory.cs @@ -94,7 +94,6 @@ internal static TcpClient CreateTcpClientAsync(AddressFamily addressFamily, Hali { SendTimeout = (int)halibutTimeoutsAndLimits.TcpClientSendTimeout.TotalMilliseconds, ReceiveTimeout = (int)halibutTimeoutsAndLimits.TcpClientReceiveTimeout.TotalMilliseconds, - LingerState = new LingerOption(true, 0) }; if (client.Client.AddressFamily == AddressFamily.InterNetworkV6)