shared-ptr has been turned into a unique-ptr for the tcp-state

This commit is contained in:
Emiel Bruijntjes 2018-03-10 14:55:57 +01:00
parent 11786ff10b
commit d2b2d5af14
2 changed files with 9 additions and 6 deletions

View File

@ -5,7 +5,7 @@
* IO between the client application and the RabbitMQ server. * IO between the client application and the RabbitMQ server.
* *
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
* @copyright 2015 - 2016 Copernica BV * @copyright 2015 - 2018 Copernica BV
*/ */
/** /**
@ -34,9 +34,7 @@ private:
/** /**
* The state of the TCP connection - this state objecs changes based on * The state of the TCP connection - this state objecs changes based on
* the state of the connection (resolving, connected or closed) * the state of the connection (resolving, connected or closed)
* a shared pointer is used because we use a forward declaration, which isn't * @var std::unique_ptr<TcpState>
* allowed in a unique pointer
* @var std::shared_ptr<TcpState>
*/ */
std::shared_ptr<TcpState> _state; std::shared_ptr<TcpState> _state;
@ -116,7 +114,7 @@ public:
/** /**
* Destructor * Destructor
*/ */
virtual ~TcpConnection() noexcept {} virtual ~TcpConnection() noexcept;
/** /**
* The filedescriptor that is used for this connection * The filedescriptor that is used for this connection

View File

@ -4,7 +4,7 @@
* Implementation file for the TCP connection * Implementation file for the TCP connection
* *
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
* @copyright 2015 - 2016 Copernica BV * @copyright 2015 - 2018 Copernica BV
*/ */
/** /**
@ -27,6 +27,11 @@ TcpConnection::TcpConnection(TcpHandler *handler, const Address &address) :
_state(new TcpResolver(this, address.hostname(), address.port(), address.secure(), handler)), _state(new TcpResolver(this, address.hostname(), address.port(), address.secure(), handler)),
_connection(this, address.login(), address.vhost()) {} _connection(this, address.login(), address.vhost()) {}
/**
* Destructor
*/
TcpConnection::~TcpConnection() noexcept = default;
/** /**
* The filedescriptor that is used for this connection * The filedescriptor that is used for this connection
* @return int * @return int