From: Forest Date: Wed, 10 Apr 2019 19:53:34 +0000 (-0700) Subject: Make TCP dispose consistent X-Git-Tag: 1.0.0~49 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=eda429ae1e774692988275bf8fa69d7f50204816;p=rhonda%2Fimpostor.hazel.git Make TCP dispose consistent --- 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 { } } }