PROTON-1517: C++ consistent linkage for listen_handler Make it all non-inline, consistent with message_handler. Fixes ASAN runtime warnings caused by duplicate vtables.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/1d2d7919 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/1d2d7919 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/1d2d7919 Branch: refs/heads/go1 Commit: 1d2d791921bea582b27778bf0b5ebb1853c7e95a Parents: 31d5ba0 Author: Alan Conway <acon...@redhat.com> Authored: Tue Oct 10 18:42:01 2017 -0400 Committer: Alan Conway <acon...@redhat.com> Committed: Wed Oct 11 22:04:42 2017 -0400 ---------------------------------------------------------------------- .../bindings/cpp/include/proton/listen_handler.hpp | 14 ++++++++------ .../bindings/cpp/include/proton/messaging_handler.hpp | 2 +- proton-c/bindings/cpp/src/listener.cpp | 9 ++++++++- 3 files changed, 17 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1d2d7919/proton-c/bindings/cpp/include/proton/listen_handler.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/listen_handler.hpp b/proton-c/bindings/cpp/include/proton/listen_handler.hpp index 3e18475..d19be3f 100644 --- a/proton-c/bindings/cpp/include/proton/listen_handler.hpp +++ b/proton-c/bindings/cpp/include/proton/listen_handler.hpp @@ -23,6 +23,8 @@ */ #include "./fwd.hpp" +#include "./internal/export.hpp" +#include <string> /// @file /// @copybrief proton::listen_handler @@ -34,12 +36,12 @@ namespace proton { /// /// Implement this interface and pass to proton::container::listen() /// to be notified of new connections. -class listen_handler { +class PN_CPP_CLASS_EXTERN listen_handler { public: - virtual ~listen_handler() {} + PN_CPP_EXTERN virtual ~listen_handler(); /// Called when the listener is opened successfully. - virtual void on_open(listener&) {} + PN_CPP_EXTERN virtual void on_open(listener&); /// Called for each accepted connection. /// @@ -47,14 +49,14 @@ class listen_handler { /// the connection. messaging_handler::on_connection_open() will be called with /// the proton::connection, it can call connection::open() to accept or /// connection::close() to reject the connection. - virtual connection_options on_accept(listener&)= 0; + PN_CPP_EXTERN virtual connection_options on_accept(listener&)= 0; /// Called if there is a listening error, with an error message. /// close() will also be called. - virtual void on_error(listener&, const std::string&) {} + PN_CPP_EXTERN virtual void on_error(listener&, const std::string&); /// Called when this listen_handler is no longer needed, and can be deleted. - virtual void on_close(listener&) {} + PN_CPP_EXTERN virtual void on_close(listener&); }; } // proton http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1d2d7919/proton-c/bindings/cpp/include/proton/messaging_handler.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/messaging_handler.hpp b/proton-c/bindings/cpp/include/proton/messaging_handler.hpp index e777d7d..938d3ff 100644 --- a/proton-c/bindings/cpp/include/proton/messaging_handler.hpp +++ b/proton-c/bindings/cpp/include/proton/messaging_handler.hpp @@ -80,7 +80,7 @@ PN_CPP_CLASS_EXTERN messaging_handler { /// The underlying network transport is open PN_CPP_EXTERN virtual void on_transport_open(transport &t); - + /// The underlying network transport has closed. PN_CPP_EXTERN virtual void on_transport_close(transport &t); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1d2d7919/proton-c/bindings/cpp/src/listener.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/listener.cpp b/proton-c/bindings/cpp/src/listener.cpp index 2e38076..646cfe1 100644 --- a/proton-c/bindings/cpp/src/listener.cpp +++ b/proton-c/bindings/cpp/src/listener.cpp @@ -17,7 +17,9 @@ * under the License. */ +#include "proton/connection_options.hpp" #include "proton/listener.hpp" +#include "proton/listen_handler.hpp" #include <proton/listener.h> @@ -32,7 +34,12 @@ listener::listener(const listener& l) : listener_(l.listener_) {} listener::~listener() {} listener& listener::operator=(const listener& l) { listener_ = l.listener_; return *this; } -// FIXME aconway 2017-10-06: should be a no-op if already closed +// FIXME aconway 2017-10-06: should be a no-op if already closed - there is a race here. void listener::stop() { if (listener_) pn_listener_close(listener_); } +listen_handler::~listen_handler() {} +void listen_handler::on_open(listener&) {} +connection_options listen_handler::on_accept(listener&) { return connection_options(); } +void listen_handler::on_error(listener&, const std::string&) {} +void listen_handler::on_close(listener&) {} } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org