From eda429ae1e774692988275bf8fa69d7f50204816 Mon Sep 17 00:00:00 2001 From: Forest Date: Wed, 10 Apr 2019 12:53:34 -0700 Subject: [PATCH] Make TCP dispose consistent --- Hazel/Tcp/TcpConnection.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Hazel/Tcp/TcpConnection.cs b/Hazel/Tcp/TcpConnection.cs index 83ac080..8103885 100644 --- a/Hazel/Tcp/TcpConnection.cs +++ b/Hazel/Tcp/TcpConnection.cs @@ -343,9 +343,9 @@ namespace Hazel.Tcp { State = ConnectionState.NotConnected; - if (socket.Connected) - socket.Shutdown(SocketShutdown.Send); - socket.Close(); + try { this.socket.Shutdown(SocketShutdown.Both); } catch { } + try { this.socket.Close(); } catch { } + try { this.socket.Dispose(); } catch { } } } -- 2.39.5