Skip to content

Commit

Permalink
Avoid throw SocketException(10057) in TcpSocketChannel.DoClose when t…
Browse files Browse the repository at this point in the history
…he Socket is not connected (#508)
  • Loading branch information
yyjdelete authored and nayato committed Oct 15, 2019
1 parent 13f0094 commit d65154c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/DotNetty.Transport/Channels/Sockets/TcpSocketChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,12 @@ protected override void DoClose()
{
try
{
if (this.TryResetState(StateFlags.Open | StateFlags.Active))
if (this.TryResetState(StateFlags.Open))
{
this.Socket.Shutdown(SocketShutdown.Both);
if (this.TryResetState(StateFlags.Active))
{
this.Socket.Shutdown(SocketShutdown.Both);
}
this.Socket.Dispose();
}
}
Expand Down

0 comments on commit d65154c

Please sign in to comment.