Skip to content

Commit

Permalink
Finish porting #1145 to main
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebakken committed Feb 23, 2022
1 parent a3a5e05 commit 015bc51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion projects/RabbitMQ.Client/client/impl/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public Connection(IConnectionFactory factory, IFrameHandler frameHandler, string
}
catch
{
TerminateMainloop();
var ea = new ShutdownEventArgs(ShutdownInitiator.Library, Constants.InternalError, "FailedOpen");
Close(ea, true, TimeSpan.FromSeconds(5));
throw;
}
}
Expand Down
7 changes: 4 additions & 3 deletions projects/RabbitMQ.Client/client/impl/SocketFrameHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,18 @@ public void Close()
try
{
_channelWriter.Complete();
_writerTask.GetAwaiter().GetResult();
_writerTask?.GetAwaiter().GetResult();
}
catch (Exception)
catch
{
// ignore, we are closing anyway
}

try
{
_socket.Close();
}
catch (Exception)
catch
{
// ignore, we are closing anyway
}
Expand Down

0 comments on commit 015bc51

Please sign in to comment.