From 2b707d53def580f57bb13b93e329d7cf4c29261c Mon Sep 17 00:00:00 2001 From: Stuart Longland Date: Sat, 2 May 2015 20:41:19 +1000 Subject: [PATCH] QAmqpChannel: Emit closed signal when server closes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/qamqpchannel.cpp | 8 ++++++++ src/qamqpchannel_p.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/qamqpchannel.cpp b/src/qamqpchannel.cpp index f20b1ae..5cd5254 100644 --- a/src/qamqpchannel.cpp +++ b/src/qamqpchannel.cpp @@ -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(); diff --git a/src/qamqpchannel_p.h b/src/qamqpchannel_p.h index 7551950..a84e19b 100644 --- a/src/qamqpchannel_p.h +++ b/src/qamqpchannel_p.h @@ -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);