complete close handshakes properly for Client and Channel

We had frame handlers for Close messages from the server, but were not
doing our due diligence and sending a corresponding CloseOk back to the
server after processing. It seems RabbitMQ is generous in this case, but
at least we're doing it the right way now
This commit is contained in:
Matt Broadstone 2014-08-07 14:12:28 -04:00
parent 1ebe3bd667
commit 695f7d2997
4 changed files with 8 additions and 14 deletions

View File

@ -195,12 +195,11 @@ void ChannelPrivate::close(const Frame::Method &frame)
qAmqpDebug(">> class-id: %d", classId);
qAmqpDebug(">> method-id: %d", methodId);
Q_EMIT q->closed();
}
void ChannelPrivate::closeOk()
{
Frame::Method frame(Frame::fcChannel, miCloseOk);
sendFrame(frame);
// complete handshake
Frame::Method closeOkFrame(Frame::fcChannel, miCloseOk);
closeOkFrame.setChannel(channelNumber);
sendFrame(closeOkFrame);
}
void ChannelPrivate::closeOk(const Frame::Method &)

View File

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

View File

@ -447,6 +447,10 @@ void ClientPrivate::close(const Frame::Method &frame)
qAmqpDebug(">> method-id: %d", methodId);
connected = false;
Q_EMIT q->disconnected();
// complete handshake
Frame::Method closeOkFrame(Frame::fcConnection, ClientPrivate::miCloseOk);
sendFrame(closeOkFrame);
}
void ClientPrivate::startOk()
@ -517,13 +521,6 @@ void ClientPrivate::close(int code, const QString &text, int classId, int method
sendFrame(frame);
}
void ClientPrivate::closeOk()
{
Frame::Method frame(Frame::fcConnection, ClientPrivate::miCloseOk);
connected = false;
sendFrame(frame);
}
//////////////////////////////////////////////////////////////////////////
Client::Client(QObject *parent)

View File

@ -75,7 +75,6 @@ public:
// method handlers, BOTH ways
void close(int code, const QString &text, int classId = 0, int methodId = 0);
void close(const Frame::Method &frame);
void closeOk();
quint16 port;
QString host;