Author: gsim
Date: Wed Jan 11 16:53:51 2012
New Revision: 1230143

URL: http://svn.apache.org/viewvc?rev=1230143&view=rev
Log:
QPID-3352: Fix test for failed session to avoid confusion with as yet 
uninitialised session

Modified:
    qpid/branches/qpid-3603/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp
    qpid/branches/qpid-3603/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h
    qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Bridge.cpp
    qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Bridge.h
    qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Link.cpp

Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp?rev=1230143&r1=1230142&r2=1230143&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp 
(original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp Wed 
Jan 11 16:53:51 2012
@@ -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:
     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

Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h?rev=1230143&r1=1230142&r2=1230143&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h 
(original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h Wed 
Jan 11 16:53:51 2012
@@ -67,6 +67,8 @@ class QPID_COMMON_CLASS_EXTERN SessionHa
 
     /** 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 SessionHa
     framing::AMQP_AllProxy::Session  peer;
     std::string name;
     bool awaitingDetached;
-    bool sendReady, receiveReady;
+    bool sendReady, receiveReady, hasFailed;
 };
 }} // namespace qpid::amqp_0_10
 

Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Bridge.cpp
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Bridge.cpp?rev=1230143&r1=1230142&r2=1230143&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Bridge.cpp (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Bridge.cpp Wed Jan 11 
16:53:51 2012
@@ -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

Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Bridge.h
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Bridge.h?rev=1230143&r1=1230142&r2=1230143&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Bridge.h (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Bridge.h Wed Jan 11 
16:53:51 2012
@@ -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,

Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Link.cpp
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Link.cpp?rev=1230143&r1=1230142&r2=1230143&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Link.cpp (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Link.cpp Wed Jan 11 
16:53:51 2012
@@ -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();



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org

Reply via email to