diff options
author | Gordon Sim <gsim@apache.org> | 2012-01-11 16:53:51 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2012-01-11 16:53:51 +0000 |
commit | 7de5876c2d2e470f70de6fb2d8f5567a2853fdf3 (patch) | |
tree | 91bd09dd5bd224ee802e9f984ac989334bb91695 | |
parent | 2e6a4681e48bd55926150690c5403f8173c21506 (diff) | |
download | qpid-python-7de5876c2d2e470f70de6fb2d8f5567a2853fdf3.tar.gz |
QPID-3352: Fix test for failed session to avoid confusion with as yet uninitialised session
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid-3603@1230143 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp | 6 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h | 4 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/broker/Bridge.cpp | 5 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/broker/Bridge.h | 2 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/broker/Link.cpp | 2 |
5 files changed, 12 insertions, 7 deletions
diff --git a/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp b/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp index 5eedafc77b..e60b7739d8 100644 --- a/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp +++ b/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp @@ -42,7 +42,7 @@ void SessionHandler::checkAttached() { SessionHandler::SessionHandler(FrameHandler* out, ChannelId ch) : channel(ch, out), peer(channel), awaitingDetached(false), - sendReady(), receiveReady() {} + sendReady(), receiveReady(), hasFailed(false) {} SessionHandler::~SessionHandler() {} @@ -192,6 +192,7 @@ void SessionHandler::detached(const std::string& /*name*/, uint8_t code) { awaitingDetached = false; if (code != session::DETACH_CODE_NORMAL) { sendReady = receiveReady = false; + hasFailed = true; channelException(convert(code), "session.detached from peer."); } else { handleDetach(); @@ -330,6 +331,9 @@ void SessionHandler::sendFlush() { bool SessionHandler::ready() const { return sendReady && receiveReady; } +bool SessionHandler::failed() const { + return hasFailed; +} }} // namespace qpid::broker diff --git a/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h b/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h index 8b072fa05c..d0e10b9908 100644 --- a/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h +++ b/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h @@ -67,6 +67,8 @@ class QPID_COMMON_CLASS_EXTERN SessionHandler : public framing::AMQP_AllOperatio /** True if the handler is ready to send and receive */ QPID_COMMON_EXTERN bool ready() const; + /** True if the session has failed with an execution exception */ + QPID_COMMON_EXTERN bool failed() const; // Protocol methods QPID_COMMON_EXTERN void attach(const std::string& name, bool force); @@ -111,7 +113,7 @@ class QPID_COMMON_CLASS_EXTERN SessionHandler : public framing::AMQP_AllOperatio framing::AMQP_AllProxy::Session peer; std::string name; bool awaitingDetached; - bool sendReady, receiveReady; + bool sendReady, receiveReady, hasFailed; }; }} // namespace qpid::amqp_0_10 diff --git a/qpid/cpp/src/qpid/broker/Bridge.cpp b/qpid/cpp/src/qpid/broker/Bridge.cpp index 405482da5d..02034811bf 100644 --- a/qpid/cpp/src/qpid/broker/Bridge.cpp +++ b/qpid/cpp/src/qpid/broker/Bridge.cpp @@ -178,10 +178,9 @@ void Bridge::destroy() listener(this); } -bool Bridge::isSessionReady() const +bool Bridge::hasSessionFailed() const { - SessionHandler& sessionHandler = conn->getChannel(id); - return sessionHandler.ready(); + return conn->getChannel(id).failed(); } void Bridge::setPersistenceId(uint64_t pId) const diff --git a/qpid/cpp/src/qpid/broker/Bridge.h b/qpid/cpp/src/qpid/broker/Bridge.h index b849b11ba8..c8df0c170a 100644 --- a/qpid/cpp/src/qpid/broker/Bridge.h +++ b/qpid/cpp/src/qpid/broker/Bridge.h @@ -63,7 +63,7 @@ public: void destroy(); bool isDurable() { return args.i_durable; } - bool isSessionReady() const; + bool hasSessionFailed() const; management::ManagementObject* GetManagementObject() const; management::Manageable::status_t ManagementMethod(uint32_t methodId, diff --git a/qpid/cpp/src/qpid/broker/Link.cpp b/qpid/cpp/src/qpid/broker/Link.cpp index 0e3f257cbb..fa3d483f9f 100644 --- a/qpid/cpp/src/qpid/broker/Link.cpp +++ b/qpid/cpp/src/qpid/broker/Link.cpp @@ -253,7 +253,7 @@ void Link::ioThreadProcessing() // check for bridge session errors and recover if (!active.empty()) { Bridges::iterator removed = std::remove_if( - active.begin(), active.end(), !boost::bind(&Bridge::isSessionReady, _1)); + active.begin(), active.end(), boost::bind(&Bridge::hasSessionFailed, _1)); for (Bridges::iterator i = removed; i != active.end(); ++i) { Bridge::shared_ptr bridge = *i; bridge->closed(); |