From 45ca61cc438c54ed638d2e35616274ccf9799e7e Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Wed, 14 Nov 2018 14:15:52 +0100 Subject: [PATCH 1/3] added TcpConnection::closed() --- include/amqpcpp/linux_tcp/tcpconnection.h | 8 ++++++++ src/linux_tcp/tcpclosed.h | 6 ++++++ src/linux_tcp/tcpconnection.cpp | 9 +++++++++ src/linux_tcp/tcpstate.h | 6 ++++++ 4 files changed, 29 insertions(+) diff --git a/include/amqpcpp/linux_tcp/tcpconnection.h b/include/amqpcpp/linux_tcp/tcpconnection.h index dd1aabd..2040793 100644 --- a/include/amqpcpp/linux_tcp/tcpconnection.h +++ b/include/amqpcpp/linux_tcp/tcpconnection.h @@ -238,6 +238,8 @@ public: /** * Is the connection in a usable state / not yet closed or being closed + * When a connection is usable, you can send further commands over it. When it is + * unusable, it may still be connected and finished queued commands. * @return bool */ bool usable() const @@ -245,6 +247,12 @@ public: return _connection.usable(); } + /** + * Is the connection closed and full dead? The entire TCP connection has been discarded. + * @return bool + */ + bool closed() const; + /** * The max frame size. Useful if you set up a buffer to parse incoming data: it does not have to exceed this size. * @return uint32_t diff --git a/src/linux_tcp/tcpclosed.h b/src/linux_tcp/tcpclosed.h index 90d5fd6..e33d4f8 100644 --- a/src/linux_tcp/tcpclosed.h +++ b/src/linux_tcp/tcpclosed.h @@ -41,6 +41,12 @@ public: * Destructor */ virtual ~TcpClosed() noexcept = default; + + /** + * Is this a closed / dead state? + * @return bool + */ + virtual bool closed() const override { return true; } }; /** diff --git a/src/linux_tcp/tcpconnection.cpp b/src/linux_tcp/tcpconnection.cpp index d01792c..f4763d9 100644 --- a/src/linux_tcp/tcpconnection.cpp +++ b/src/linux_tcp/tcpconnection.cpp @@ -57,6 +57,15 @@ std::size_t TcpConnection::queued() const return _state->queued(); } +/** + * Is the connection closed and full dead? The entire TCP connection has been discarded. + * @return bool + */ +bool TcpConnection::closed() const +{ + return _state->closed(); +} + /** * Process the TCP connection * This method should be called when the filedescriptor that is registered diff --git a/src/linux_tcp/tcpstate.h b/src/linux_tcp/tcpstate.h index 190091c..4699498 100644 --- a/src/linux_tcp/tcpstate.h +++ b/src/linux_tcp/tcpstate.h @@ -62,6 +62,12 @@ public: * @return size_t */ virtual std::size_t queued() const { return 0; } + + /** + * Is this a closed / dead state? + * @return bool + */ + virtual bool closed() const { return false; } /** * Process the filedescriptor in the object From 1dd04760a92ee02e99e778434ad370fcdb47bd4a Mon Sep 17 00:00:00 2001 From: Rafal Goslawski Date: Thu, 15 Nov 2018 11:48:34 +0100 Subject: [PATCH 2/3] Bump version to 4.0.0 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a5a9ca6..0ea9e6e 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,8 @@ PREFIX ?= /usr INCLUDE_DIR = ${PREFIX}/include LIBRARY_DIR = ${PREFIX}/lib export LIBRARY_NAME = amqpcpp -export SONAME = 3.2 -export VERSION = 3.2.0 +export SONAME = 4.0 +export VERSION = 4.0.0 all: $(MAKE) -C src all From bddceb77f2cd5a1ae137928e8553915612920fab Mon Sep 17 00:00:00 2001 From: Rafal Goslawski Date: Thu, 15 Nov 2018 11:48:53 +0100 Subject: [PATCH 3/3] Bump version to 4.0.0 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b632d5f..ff729d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,8 +14,8 @@ cmake_minimum_required(VERSION 3.2 FATAL_ERROR) # project name project(amqpcpp) -set (VERSION_MAJOR 3) -set (VERSION_MINOR 2) +set (VERSION_MAJOR 4) +set (VERSION_MINOR 0) set (VERSION_PATCH 0) set (SO_VERSION ${VERSION_MAJOR}.${VERSION_MINOR})