You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2013/06/28 14:23:16 UTC

svn commit: r1497749 - in /qpid/trunk/qpid/cpp/src/qpid/messaging/amqp: ConnectionContext.cpp ConnectionContext.h

Author: gsim
Date: Fri Jun 28 12:23:15 2013
New Revision: 1497749

URL: http://svn.apache.org/r1497749
Log:
QPID-4966: ensure timeout is honoured while waiting of rmessages

Modified:
    qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp
    qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h

Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp?rev=1497749&r1=1497748&r2=1497749&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp Fri Jun 28 12:23:15 2013
@@ -270,7 +270,7 @@ bool ConnectionContext::get(boost::share
             pn_link_advance(lnk->receiver);
             return true;
         } else if (until > qpid::sys::now()) {
-            wait(ssn, lnk);
+            waitUntil(ssn, lnk, until);
         } else {
             return false;
         }
@@ -427,9 +427,8 @@ pn_state_t REQUIRES_CLOSE = PN_LOCAL_ACT
 pn_state_t IS_CLOSED = PN_LOCAL_CLOSED | PN_REMOTE_CLOSED;
 }
 
-void ConnectionContext::wait()
+void ConnectionContext::check()
 {
-    lock.wait();
     if (state == DISCONNECTED) {
         throw qpid::messaging::TransportFailure("Disconnected");
     }
@@ -438,6 +437,17 @@ void ConnectionContext::wait()
         throw qpid::messaging::ConnectionError("Connection closed by peer");
     }
 }
+
+void ConnectionContext::wait()
+{
+    lock.wait();
+    check();
+}
+void ConnectionContext::waitUntil(qpid::sys::AbsTime until)
+{
+    lock.wait(until);
+    check();
+}
 void ConnectionContext::wait(boost::shared_ptr<SessionContext> ssn)
 {
     wait();
@@ -453,6 +463,21 @@ void ConnectionContext::wait(boost::shar
     wait();
     checkClosed(ssn, lnk);
 }
+void ConnectionContext::waitUntil(boost::shared_ptr<SessionContext> ssn, qpid::sys::AbsTime until)
+{
+    waitUntil(until);
+    checkClosed(ssn);
+}
+void ConnectionContext::waitUntil(boost::shared_ptr<SessionContext> ssn, boost::shared_ptr<ReceiverContext> lnk, qpid::sys::AbsTime until)
+{
+    waitUntil(until);
+    checkClosed(ssn, lnk);
+}
+void ConnectionContext::waitUntil(boost::shared_ptr<SessionContext> ssn, boost::shared_ptr<SenderContext> lnk, qpid::sys::AbsTime until)
+{
+    waitUntil(until);
+    checkClosed(ssn, lnk);
+}
 void ConnectionContext::checkClosed(boost::shared_ptr<SessionContext> ssn)
 {
     if ((pn_session_state(ssn->session) & REQUIRES_CLOSE) == REQUIRES_CLOSE) {

Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h?rev=1497749&r1=1497748&r2=1497749&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.h Fri Jun 28 12:23:15 2013
@@ -135,10 +135,15 @@ class ConnectionContext : public qpid::s
     };
     CodecSwitch codecSwitch;
 
+    void check();
     void wait();
+    void waitUntil(qpid::sys::AbsTime until);
     void wait(boost::shared_ptr<SessionContext>);
+    void waitUntil(boost::shared_ptr<SessionContext>, qpid::sys::AbsTime until);
     void wait(boost::shared_ptr<SessionContext>, boost::shared_ptr<ReceiverContext>);
     void wait(boost::shared_ptr<SessionContext>, boost::shared_ptr<SenderContext>);
+    void waitUntil(boost::shared_ptr<SessionContext>, boost::shared_ptr<ReceiverContext>, qpid::sys::AbsTime until);
+    void waitUntil(boost::shared_ptr<SessionContext>, boost::shared_ptr<SenderContext>, qpid::sys::AbsTime until);
     void checkClosed(boost::shared_ptr<SessionContext>);
     void checkClosed(boost::shared_ptr<SessionContext>, boost::shared_ptr<ReceiverContext>);
     void checkClosed(boost::shared_ptr<SessionContext>, boost::shared_ptr<SenderContext>);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org