diff options
| author | Gordon Sim <gsim@apache.org> | 2013-10-21 11:57:33 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2013-10-21 11:57:33 +0000 |
| commit | 16435979b90825adeb49a4d5558cfcdcb56ec0f4 (patch) | |
| tree | ee736cb3cd5a475ff7298b923bdfd3a1d8b05292 /qpid/cpp/src | |
| parent | 67c066df96661830ff57ad569c0064506236726b (diff) | |
| download | qpid-python-16435979b90825adeb49a4d5558cfcdcb56ec0f4.tar.gz | |
QPID-5247: implement Receiver::isClosed()
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1534108 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
5 files changed, 11 insertions, 7 deletions
diff --git a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp index b9af682aa0..b230aeaf0d 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp +++ b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp @@ -476,6 +476,15 @@ void ConnectionContext::checkClosed(boost::shared_ptr<SessionContext> ssn) } } +bool ConnectionContext::isClosed(boost::shared_ptr<SessionContext> ssn, boost::shared_ptr<ReceiverContext> lnk) +{ + try { + checkClosed(ssn, lnk->receiver); + return false; + } catch (const LinkError&) { + return true; + } +} void ConnectionContext::checkClosed(boost::shared_ptr<SessionContext> ssn, boost::shared_ptr<ReceiverContext> lnk) { checkClosed(ssn, lnk->receiver); diff --git a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h index eb1be8e5fd..b31ffe62e9 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h +++ b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h @@ -77,6 +77,7 @@ class ConnectionContext : public qpid::sys::ConnectionCodec, public qpid::messag void attach(boost::shared_ptr<SessionContext>, boost::shared_ptr<ReceiverContext>); void detach(boost::shared_ptr<SessionContext>, boost::shared_ptr<SenderContext>); void detach(boost::shared_ptr<SessionContext>, boost::shared_ptr<ReceiverContext>); + bool isClosed(boost::shared_ptr<SessionContext>, boost::shared_ptr<ReceiverContext>); void send(boost::shared_ptr<SessionContext>, boost::shared_ptr<SenderContext> ctxt, const qpid::messaging::Message& message, bool sync); bool fetch(boost::shared_ptr<SessionContext> ssn, boost::shared_ptr<ReceiverContext> lnk, qpid::messaging::Message& message, qpid::messaging::Duration timeout); bool get(boost::shared_ptr<SessionContext> ssn, boost::shared_ptr<ReceiverContext> lnk, qpid::messaging::Message& message, qpid::messaging::Duration timeout); diff --git a/qpid/cpp/src/qpid/messaging/amqp/ReceiverContext.cpp b/qpid/cpp/src/qpid/messaging/amqp/ReceiverContext.cpp index 473c120e27..2a45ccee44 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ReceiverContext.cpp +++ b/qpid/cpp/src/qpid/messaging/amqp/ReceiverContext.cpp @@ -123,11 +123,6 @@ Address ReceiverContext::getAddress() const return address; } -bool ReceiverContext::isClosed() const -{ - return false;//TODO -} - void ReceiverContext::reset(pn_session_t* session) { receiver = pn_receiver(session, name.c_str()); diff --git a/qpid/cpp/src/qpid/messaging/amqp/ReceiverContext.h b/qpid/cpp/src/qpid/messaging/amqp/ReceiverContext.h index fb8ea0d336..c68ea10ba3 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ReceiverContext.h +++ b/qpid/cpp/src/qpid/messaging/amqp/ReceiverContext.h @@ -55,7 +55,6 @@ class ReceiverContext void close(); const std::string& getName() const; const std::string& getSource() const; - bool isClosed() const; void configure(); void verify(); Address getAddress() const; diff --git a/qpid/cpp/src/qpid/messaging/amqp/ReceiverHandle.cpp b/qpid/cpp/src/qpid/messaging/amqp/ReceiverHandle.cpp index 177f47896b..bd7082079c 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ReceiverHandle.cpp +++ b/qpid/cpp/src/qpid/messaging/amqp/ReceiverHandle.cpp @@ -100,7 +100,7 @@ qpid::messaging::Session ReceiverHandle::getSession() const bool ReceiverHandle::isClosed() const { - return receiver->isClosed(); + return connection->isClosed(session, receiver); } Address ReceiverHandle::getAddress() const |
