diff options
Diffstat (limited to 'qpid/cpp/src/qpid/broker/Link.cpp')
| -rw-r--r-- | qpid/cpp/src/qpid/broker/Link.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/qpid/cpp/src/qpid/broker/Link.cpp b/qpid/cpp/src/qpid/broker/Link.cpp index b605ca71e5..467d422721 100644 --- a/qpid/cpp/src/qpid/broker/Link.cpp +++ b/qpid/cpp/src/qpid/broker/Link.cpp @@ -267,13 +267,20 @@ void Link::setUrl(const Url& u) { namespace { - /** invoked when session used to subscribe to remote's amq.failover exchange detaches */ - void sessionDetached(Link *link) { - QPID_LOG(notice, "detached from 'amq.failover' for link: " << link->getName()); +class DetachedCallback : public SessionHandler::ErrorListener { + public: + DetachedCallback(const Link& link) : name(link.getName()) {} + void connectionException(framing::connection::CloseCode, const std::string&) {} + void channelException(framing::session::DetachCode, const std::string&) {} + void executionException(framing::execution::ErrorCode, const std::string&) {} + void detach() { + QPID_LOG(notice, "detached from 'amq.failover' for link: " << name); } + private: + const std::string name; +}; } - void Link::opened() { Mutex::ScopedLock mutex(lock); if (!connection) return; @@ -301,7 +308,8 @@ void Link::opened() { failoverChannel = nextChannel(); SessionHandler& sessionHandler = connection->getChannel(failoverChannel); - sessionHandler.setDetachedCallback( boost::bind(&sessionDetached, this) ); + sessionHandler.setErrorListener( + boost::shared_ptr<SessionHandler::ErrorListener>(new DetachedCallback(*this))); failoverSession = queueName; sessionHandler.attachAs(failoverSession); |
