diff options
author | Alan Conway <aconway@apache.org> | 2012-01-18 22:08:22 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2012-01-18 22:08:22 +0000 |
commit | 237af7e92427c9dd3ea6ccd8912ce6a436cc7627 (patch) | |
tree | e35a2ffa49dcb394d547caff646fcd02bd957c9f | |
parent | 6fb07470e12c3c5d64a3babda1e5eb882dbf1c81 (diff) | |
download | qpid-python-237af7e92427c9dd3ea6ccd8912ce6a436cc7627.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/trunk@1233083 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 c709606c17..12c2194381 100644 --- a/qpid/cpp/src/qpid/broker/Bridge.cpp +++ b/qpid/cpp/src/qpid/broker/Bridge.cpp @@ -164,10 +164,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 8b4559a871..d8062760fc 100644 --- a/qpid/cpp/src/qpid/broker/Bridge.h +++ b/qpid/cpp/src/qpid/broker/Bridge.h @@ -59,7 +59,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 8010bf43e7..7e1767fed7 100644 --- a/qpid/cpp/src/qpid/broker/Link.cpp +++ b/qpid/cpp/src/qpid/broker/Link.cpp @@ -251,7 +251,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(); |