QAmqpChannel: Emit closed signal when server closes.

When we initiate a Close, we get a CloseOk in response and on receipt of
the CloseOk, we mark the channel as closed and emit a signal to notify
everyone else.

Great.  Now what happens when the server closes the channel?  We emit a
CloseOk, then… nothing.  We do nothing.  This fixes this problem, moving
the notification/marking logic to a new function and calling that on
both Close (sent from server) and CloseOk.
This commit is contained in:
Stuart Longland 2015-05-02 20:41:19 +10:00
parent 568dc6770a
commit 2b707d53de
2 changed files with 9 additions and 0 deletions

View File

@ -203,9 +203,17 @@ void QAmqpChannelPrivate::close(const QAmqpMethodFrame &frame)
QAmqpMethodFrame closeOkFrame(QAmqpFrame::Channel, miCloseOk);
closeOkFrame.setChannel(channelNumber);
sendFrame(closeOkFrame);
// notify everyone that the channel was closed on us.
notifyClosed();
}
void QAmqpChannelPrivate::closeOk(const QAmqpMethodFrame &)
{
notifyClosed();
}
void QAmqpChannelPrivate::notifyClosed()
{
Q_Q(QAmqpChannel);
Q_EMIT q->closed();

View File

@ -44,6 +44,7 @@ public:
void flow(bool active);
void flowOk();
void close(int code, const QString &text, int classId, int methodId);
void notifyClosed();
// reimp MethodHandler
virtual bool _q_method(const QAmqpMethodFrame &frame);