From 875300dbce5c2dc8b54e9540c0e4e7210d8ca073 Mon Sep 17 00:00:00 2001 From: Toon Schoenmakers Date: Mon, 2 Nov 2015 17:47:21 +0100 Subject: [PATCH 1/2] Exposed the channels method in the TcpConnection class and added a more specialized constructor to the Address class --- include/address.h | 11 +++++++++++ include/tcpconnection.h | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/address.h b/include/address.h index a78ef3a..f937b84 100644 --- a/include/address.h +++ b/include/address.h @@ -109,6 +109,17 @@ public: * @param address */ Address(const std::string &address) : Address(address.data()) {} + + /** + * Constructor based on already known properties + * @param host + * @param port + * @param login + * @param vhost + */ + Address(std::string host, uint16_t port, Login login, std::string vhost) : _login(std::move(login)), + _hostname(std::move(host)), + _port(port), _vhost(std::move(vhost)) {} /** * Destructor diff --git a/include/tcpconnection.h b/include/tcpconnection.h index 1673193..eba00dc 100644 --- a/include/tcpconnection.h +++ b/include/tcpconnection.h @@ -123,6 +123,16 @@ public: // pass to the underlying connection return _connection.close(); } + + /** + * Return the amount of channels this connection has + * @return std::size_t + */ + std::size_t channels() const + { + // return the amount of channels this connection has + return _connection.channels(); + } }; /** From c783ec7618c1188b009f2badce473615d01b4b24 Mon Sep 17 00:00:00 2001 From: Toon Schoenmakers Date: Mon, 2 Nov 2015 17:53:43 +0100 Subject: [PATCH 2/2] When building the address url, username and password should be split with a colon --- include/address.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/address.h b/include/address.h index f937b84..fb7581d 100644 --- a/include/address.h +++ b/include/address.h @@ -172,7 +172,7 @@ public: std::string str("amqp://"); // append login - str.append(_login.user()).append("@").append(_login.password()).append("@").append(_hostname); + str.append(_login.user()).append(":").append(_login.password()).append("@").append(_hostname); // do we need a special portnumber? if (_port != 5672) str.append(":").append(std::to_string(_port));