Skip to content

Commit

Permalink
Merge bug24464 into default
Browse files Browse the repository at this point in the history
  • Loading branch information
Emile Joubert committed Nov 29, 2011
2 parents 140f562 + 8e407c4 commit d309982
Showing 1 changed file with 31 additions and 27 deletions.
58 changes: 31 additions & 27 deletions projects/client/RabbitMQ.Client/src/client/impl/ConnectionBase.cs
Expand Up @@ -425,38 +425,42 @@ public void Abort(ushort reasonCode, string reasonText, int timeout)
public void Close(ShutdownEventArgs reason, bool abort, int timeout)
{
if (!SetCloseReason(reason))
if (abort)
{
if (!m_appContinuation.WaitOne(BlockingCell.validatedTimeout(timeout), true))
m_frameHandler.Close();
return;
} else {
throw new AlreadyClosedException(m_closeReason);
}

OnShutdown();
m_session0.SetSessionClosing(false);

try
{
// Try to send connection.close
// Wait for CloseOk in the MainLoop
m_session0.Transmit(ConnectionCloseWrapper(reason.ReplyCode,
reason.ReplyText));
if (!abort)
throw new AlreadyClosedException(m_closeReason);
}
catch (IOException ioe) {
if (m_model0.CloseReason == null)
else
{
OnShutdown();
m_session0.SetSessionClosing(false);

try
{
// Try to send connection.close
// Wait for CloseOk in the MainLoop
m_session0.Transmit(ConnectionCloseWrapper(reason.ReplyCode,
reason.ReplyText));
}
catch (AlreadyClosedException ace)
{
if (!abort)
throw ioe;
else
LogCloseError("Couldn't close connection cleanly. "
+ "Socket closed unexpectedly", ioe);
throw ace;
}
catch (IOException ioe)
{
if (m_model0.CloseReason == null)
{
if (!abort)
throw ioe;
else
LogCloseError("Couldn't close connection cleanly. "
+ "Socket closed unexpectedly", ioe);
}
}
finally
{
TerminateMainloop();
}
}
finally
{
TerminateMainloop();
}
if (!m_appContinuation.WaitOne(BlockingCell.validatedTimeout(timeout),true))
m_frameHandler.Close();
Expand Down

0 comments on commit d309982

Please sign in to comment.