From da6744bf4da63998e1ed6324f2dbabe4f194ffe6 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Thu, 8 Nov 2018 08:34:58 +0100 Subject: [PATCH] renamed ConnectionHandler::onConnectedO() to ConnectionHandler::onReady() --- include/amqpcpp/connectionhandler.h | 8 +++++--- include/amqpcpp/connectionimpl.h | 4 ++-- include/amqpcpp/linux_tcp/tcpconnection.h | 4 ++-- src/connectionimpl.cpp | 4 ++-- src/connectionopenokframe.h | 6 +++--- src/linux_tcp/tcpconnection.cpp | 1 + 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/include/amqpcpp/connectionhandler.h b/include/amqpcpp/connectionhandler.h index 2d60ba6..fb3532d 100644 --- a/include/amqpcpp/connectionhandler.h +++ b/include/amqpcpp/connectionhandler.h @@ -171,17 +171,19 @@ public: * * @param connection The connection that can now be used */ - virtual void onConnected(Connection *connection) + virtual void onReady(Connection *connection) { // make sure compilers dont complain about unused parameters (void) connection; } /** - * Method that is called when the connection was closed. + * Method that is called when the AMQP connection was closed. * * This is the counter part of a call to Connection::close() and it confirms - * that the connection was _correctly_ closed. + * that the connection was _correctly_ closed. Note that this only applies + * to the AMQP connection, the underlying TCP connection is not managed by + * AMQP-CPP and is still active. * * @param connection The connection that was closed and that is now unusable */ diff --git a/include/amqpcpp/connectionimpl.h b/include/amqpcpp/connectionimpl.h index 8f6cb65..bdd79c0 100644 --- a/include/amqpcpp/connectionimpl.h +++ b/include/amqpcpp/connectionimpl.h @@ -254,9 +254,9 @@ public: } /** - * Mark the connection as connected + * Mark the connection as ready */ - void setConnected(); + void setReady(); /** * Retrieve the login data diff --git a/include/amqpcpp/linux_tcp/tcpconnection.h b/include/amqpcpp/linux_tcp/tcpconnection.h index 96a807e..036b98f 100644 --- a/include/amqpcpp/linux_tcp/tcpconnection.h +++ b/include/amqpcpp/linux_tcp/tcpconnection.h @@ -102,10 +102,10 @@ private: virtual void onError(Connection *connection, const char *message) override; /** - * Method that is called when the connection is established + * Method that is called when the AMQP connection is established * @param connection The connection that can now be used */ - virtual void onConnected(Connection *connection) override + virtual void onReady(Connection *connection) override { // pass on to the handler _handler->onReady(this); diff --git a/src/connectionimpl.cpp b/src/connectionimpl.cpp index e4483b9..ebf4696 100644 --- a/src/connectionimpl.cpp +++ b/src/connectionimpl.cpp @@ -306,7 +306,7 @@ bool ConnectionImpl::sendClose() /** * Mark the connection as connected */ -void ConnectionImpl::setConnected() +void ConnectionImpl::setReady() { // store connected state _state = state_connected; @@ -316,7 +316,7 @@ void ConnectionImpl::setConnected() Monitor monitor(this); // inform handler - _handler->onConnected(_parent); + _handler->onReady(_parent); // the handler could have destructed us if (!monitor.valid()) return; diff --git a/src/connectionopenokframe.h b/src/connectionopenokframe.h index 304007f..6619213 100644 --- a/src/connectionopenokframe.h +++ b/src/connectionopenokframe.h @@ -4,7 +4,7 @@ * Message sent by the server to the client to confirm that a connection to * a vhost could be established * - * @copyright 2014 Copernica BV + * @copyright 2014 - 2018 Copernica BV */ /** @@ -79,8 +79,8 @@ public: */ virtual bool process(ConnectionImpl *connection) override { - // all is ok, mark the connection as connected - connection->setConnected(); + // all is ok, mark the connection as ready + connection->setReady(); // done return true; diff --git a/src/linux_tcp/tcpconnection.cpp b/src/linux_tcp/tcpconnection.cpp index 8aec634..537d4a7 100644 --- a/src/linux_tcp/tcpconnection.cpp +++ b/src/linux_tcp/tcpconnection.cpp @@ -77,6 +77,7 @@ void TcpConnection::process(int fd, int flags) // if the state did not change, we do not have to update a member, // when the newstate is nullptr, the object is (being) destructed // and we do not have to do anything else either + // @todo what if close(true) is called that install the new TcpClosed() ???? if (newstate == nullptr || newstate == _state.get()) return; // wrap the new state in a unique-ptr so that so that the old state